2018-03-21 16:56:30 +01:00
|
|
|
var path = require('path');
|
2018-02-24 23:55:06 +01:00
|
|
|
var webpack = require('webpack');
|
|
|
|
|
2018-06-13 19:38:22 +02:00
|
|
|
module.exports = (env, argv) => ({
|
|
|
|
//mode: "development",
|
2018-02-24 23:55:06 +01:00
|
|
|
plugins: [
|
2018-06-13 19:38:22 +02:00
|
|
|
new webpack.DefinePlugin({
|
2018-06-13 21:26:15 +02:00
|
|
|
'process.env.NODE_ENV': argv.mode === 'development' ? "\"development\"" : "\"production\""
|
2018-06-13 19:38:22 +02:00
|
|
|
}),
|
|
|
|
// http://stackoverflow.com/questions/29080148/expose-jquery-to-real-window-object-with-webpack
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
// Automtically detect jQuery and $ as free var in modules
|
|
|
|
// and inject the jquery library
|
|
|
|
// This is required by many jquery plugins
|
|
|
|
jquery: "jquery",
|
|
|
|
jQuery: "jquery",
|
|
|
|
$: "jquery"
|
|
|
|
})
|
2018-02-24 23:55:06 +01:00
|
|
|
],
|
2018-03-21 16:56:30 +01:00
|
|
|
target: "web",
|
2018-05-05 05:29:22 +02:00
|
|
|
entry: {
|
2018-06-08 17:51:48 +02:00
|
|
|
"dist/engine": "./src/engine.js",
|
|
|
|
"tests/tests": "./tests/index.js",
|
2018-05-05 05:29:22 +02:00
|
|
|
},
|
2018-06-06 18:49:00 +02:00
|
|
|
devtool: "source-map",
|
2018-02-24 23:55:06 +01:00
|
|
|
output: {
|
2018-06-08 17:51:48 +02:00
|
|
|
path: path.resolve(__dirname, "./"),
|
2018-06-06 18:49:00 +02:00
|
|
|
filename: "[name].bundle.js"
|
2018-02-24 23:55:06 +01:00
|
|
|
},
|
|
|
|
module: {
|
2018-06-13 19:38:22 +02:00
|
|
|
rules: []
|
2018-03-21 16:56:30 +01:00
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
removeAvailableModules: true,
|
|
|
|
removeEmptyChunks: true,
|
|
|
|
mergeDuplicateChunks: true,
|
|
|
|
flagIncludedChunks: true,
|
|
|
|
occurrenceOrder: true,
|
|
|
|
sideEffects: true,
|
|
|
|
providedExports: false,
|
|
|
|
usedExports: false,
|
|
|
|
concatenateModules: false,
|
|
|
|
namedModules: false,
|
|
|
|
namedChunks: false,
|
|
|
|
minimize: false,
|
|
|
|
portableRecords: true
|
2018-05-05 05:36:39 +02:00
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
publicPath: "/dist",
|
2018-02-24 23:55:06 +01:00
|
|
|
}
|
2018-06-13 19:38:22 +02:00
|
|
|
});
|