1 const path = require('path');
2 const glob = require("glob");
3 const filemap = require(path.resolve(__dirname,"./webpack_util/webpack-filemap-plugin.js"));
4 const UglifyWebpackPlugin = require("uglifyjs-webpack-plugin");
6 const sourcePath = path.resolve(__dirname, "source");
7 const entryPath = path.resolve(sourcePath, "entries");
8 const legacyPath = path.resolve(sourcePath, "legacy");
15 glob.sync(path.resolve(entryPath, "**/*.js")).forEach(val => {
16 var prekey = val.replace(entryPath+"/","");
17 var key = prekey.match(/(.*)\.js$/)[1];
22 // Give entries a common library name
24 path: path.resolve(__dirname, "build/"),
26 filename: '[name].min.js',
27 chunkFilename: `chunk.[chunkhash].js`,
28 library: ["jsMod","[name]"],
31 // Set up babel and JSAN processing
36 exclude: /(node_modules|bower_components)/,
38 loader: 'babel-loader',
40 sourceType: "unambiguous",
41 presets: [['@babel/preset-env',{
46 loader: path.resolve(__dirname,"./webpack_util/jsan-preprocess-loader.js"),
47 options:{'legacyPath':legacyPath}
53 loader: path.resolve(__dirname,"./webpack_util/jsan-error-loader.js")
58 // Chunks and Minimization settings
62 minimizer: [new UglifyWebpackPlugin({
81 test: path.resolve(__dirname, "webpack_util/adaptor.js"),
94 devtool: "source-map",
95 plugins: [new filemap({'legacy_regex':"./webpack_util/dependency.regex"})]