diff options
Diffstat (limited to 'webpack.config.js')
| -rw-r--r-- | webpack.config.js | 96 |
1 files changed, 59 insertions, 37 deletions
diff --git a/webpack.config.js b/webpack.config.js index 2754b21..75a8c0b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,45 +1,67 @@ /* eslint-env node */ const path = require('path'); +const dotenv = require('dotenv'); +const webpack = require('webpack'); + +// this will update the process.env with environment variables in .env file +dotenv.config(); module.exports = { - entry: { - ui: './webAO/ui.js', - client: './webAO/client.js', - master: './webAO/master.js' - }, - output: { - path: path.resolve(__dirname, 'webAO'), - filename: '[name].b.js' + entry: { + ui: './webAO/ui.js', + client: './webAO/client.js', + master: './webAO/master.js', + }, + devtool: 'source-map', + devServer: { + static: { + directory: path.join(__dirname, 'webAO'), }, - module: { - rules: [ - { - test: /\.m?js$/, - exclude: /(node_modules|bower_components)/, - use: { - loader: 'babel-loader', - options: { - presets: [ - [ - '@babel/preset-env', { - useBuiltIns: 'usage', - targets: [ - "defaults", - "Safari > 3", - "Opera > 8", - "Android > 3" - ], - corejs: 3 - } - ] - ] - } - } - } - ] + compress: true, + port: 8080, + }, + mode: 'production', + module: { + rules: [ + { + test: /\.m?js$/, + exclude: /(node_modules|bower_components)/, + use: { + loader: 'babel-loader', + options: { + presets: [ + [ + '@babel/preset-env', { + useBuiltIns: 'usage', + targets: [ + 'defaults', + 'Safari > 3', + 'Opera > 8', + 'Android > 3', + ], + corejs: 3, + }, + ], + ], + }, + }, }, + ], + }, + output: { + path: path.resolve(__dirname, 'webAO'), + filename: '[name].b.js', + }, + performance: { + hints: false, + maxEntrypointSize: 512000, + maxAssetSize: 512000, + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': JSON.stringify(process.env), + }), + ], - devtool: 'source-map', - mode: 'production' -};
\ No newline at end of file +}; |
