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',{
42 "useBuiltIns": "usage",
47 loader
: path
.resolve(__dirname
,"./webpack_util/jsan-preprocess-loader.js"),
48 options
:{'legacyPath':legacyPath
}
54 loader
: path
.resolve(__dirname
,"./webpack_util/jsan-error-loader.js")
59 // Chunks and Minimization settings
63 minimizer
: [new UglifyWebpackPlugin({
86 test
: path
.resolve(__dirname
, "webpack_util/adaptor.js"),
99 devtool
: "source-map",
100 plugins
: [new filemap({'legacy_regex':"./webpack_util/dependency.regex"})]