Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"author": "James Friend and Alain Armand <[email protected]>",
"license": "MIT",
"dependencies": {
"@glennsl/bs-json": "^4.0.0",
"bs-fetch": "^0.5.0",
"bs-webapi": "^0.15.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"@glennsl/bs-json": "^5.0.2",
"bs-fetch": "^0.5.1",
"bs-webapi": "^0.15.6",
"react": "16.8.6",
"react-dom": "16.8.6",
"reason-react": "0.7.0"
},
"devDependencies": {
"bs-platform": "5.0.4",
"bs-platform": "7.1.0",
"compression-webpack-plugin": "^3.0.0",
"css-loader": "^3.0.0",
"electrode-bundle-analyzer": "^1.0.1",
Expand Down
110 changes: 55 additions & 55 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
const path = require('path');
const webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');
const ClosureCompilerPlugin = require('webpack-closure-compiler');
const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
const ManifestPlugin = require('webpack-manifest-plugin');
const ShakePlugin = require('webpack-common-shake').Plugin;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const rollupPluginNodeResolve = require('rollup-plugin-node-resolve');
const path = require("path");
const webpack = require("webpack");
const CompressionPlugin = require("compression-webpack-plugin");
const ClosureCompilerPlugin = require("webpack-closure-compiler");
const StatsWriterPlugin = require("webpack-stats-plugin").StatsWriterPlugin;
const ManifestPlugin = require("webpack-manifest-plugin");
const ShakePlugin = require("webpack-common-shake").Plugin;
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin");
const rollupPluginNodeResolve = require("rollup-plugin-node-resolve");

const prod = process.env.NODE_ENV == 'production';
const dev = !prod && process.env.DEV !== '0';
const analyze = process.env.NODE_ENV == 'analyze';
const useRollup = process.env.ROLLUP == '1';
const useShakePlugin = prod || process.env.SHAKE == '1';
const useClosureCompiler = process.env.CLOSURE === '1';
const prod = process.env.NODE_ENV == "production";
const dev = !prod && process.env.DEV !== "0";
const analyze = process.env.NODE_ENV == "analyze";
const useRollup = process.env.ROLLUP == "1";
const useShakePlugin = prod || process.env.SHAKE == "1";
const useClosureCompiler = process.env.CLOSURE === "1";

let publicUrl = '';
let publicUrl = "";

module.exports = {
context: __dirname,
entry: useRollup ? './lib/es6/src/index' : './lib/js/src/index',
entry: useRollup ? "./lib/es6/src/index" : "./lib/js/src/index",
output: {
filename: '[name].js',
path: path.join(__dirname, './dist/build'),
publicPath: '/build/',
filename: "[name].js",
path: path.join(__dirname, "./dist/build"),
publicPath: "/build/"
},
devServer: {
contentBase: path.resolve(__dirname, 'public'),
contentBase: path.resolve(__dirname, "public"),
historyApiFallback: true
},
resolve: {
alias: {
src: path.resolve(__dirname, 'src/'),
director: 'director/build/director',
},
src: path.resolve(__dirname, "src/"),
director: "director/build/director"
}
},
module: {
rules: [
{
test: /\.png$/,
loader: 'file-loader',
loader: "file-loader"
},
{
test: /\.css$/,
use: [{loader: 'style-loader'}, {loader: 'css-loader'}],
use: [{ loader: "style-loader" }, { loader: "css-loader" }]
},
useRollup
? {
test: /\.js$/,
loader: 'rollup-loader',
loader: "rollup-loader",
options: {
plugins: [rollupPluginNodeResolve({module: true})],
},
plugins: [rollupPluginNodeResolve({ module: true })]
}
}
: null,
].filter(Boolean),
: null
].filter(Boolean)
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
fs: "empty",
net: "empty",
tls: "empty"
},
plugins: [
// Generate a service worker script that will precache, and keep up to date,
Expand All @@ -71,67 +71,67 @@ module.exports = {
// If a URL is already hashed by Webpack, then there is no concern
// about it being stale, and the cache-busting can be skipped.
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
filename: "service-worker.js",
minify: prod || analyze,
navigateFallback: publicUrl + '/index.html',
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
navigateFallback: publicUrl + "/index.html",
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/]
}),

// Generate a manifest file which contains a mapping of all asset filenames
// to their corresponding output file so that tools can pick it up without
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json',
fileName: "asset-manifest.json"
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(!dev ? 'production' : null),
PUBLIC_URL: JSON.stringify(publicUrl + '/build'),
},
"process.env": {
NODE_ENV: JSON.stringify(!dev ? "production" : null),
PUBLIC_URL: JSON.stringify(publicUrl + "/build")
}
}),
useClosureCompiler
? new ClosureCompilerPlugin({
compiler: {
language_in: 'ECMASCRIPT6',
language_out: 'ECMASCRIPT5',
language_in: "ECMASCRIPT6",
language_out: "ECMASCRIPT5"
},
concurrency: 3,
concurrency: 3
})
: null,
prod ? new UglifyJsPlugin() : null,
analyze
? new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
// warnings: false,
},
output: {
comments: /^\**!|^ [0-9]+ $|@preserve|@license/,
},
comments: /^\**!|^ [0-9]+ $|@preserve|@license/
}
}
})
: null,
true
? new CompressionPlugin({
algorithm: 'gzip',
algorithm: "gzip",
test: /\.(js|css)$/,
threshold: 10240,
minRatio: 0.8,
minRatio: 0.8
})
: null,
true
? new StatsWriterPlugin({
filename: 'stats.json',
filename: "stats.json",
fields: null,
transform: function(data) {
data.modules.forEach(function(m) {
delete m.source;
});
delete data.children;
return JSON.stringify(data, null, 2);
},
}
})
: null,
useShakePlugin ? new ShakePlugin() : null,
].filter(Boolean),
useShakePlugin ? new ShakePlugin() : null
].filter(Boolean)
};
Loading