diff options
| author | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 12:43:33 -0500 |
|---|---|---|
| committer | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 12:43:33 -0500 |
| commit | 4bd674c196c0e06b460dffee440c5d2a48061bcc (patch) | |
| tree | 2338cf231c8535280c283d8d08d91f4fa4018912 /webpack.config.js | |
| parent | 01a7239f8b18710ce1871c502fd8d10a782efcaf (diff) | |
| parent | 9c5fd198c11a0e2b976c6a2802eff9c4fef836f6 (diff) | |
Merge branch 'master' of https://github.com/AttorneyOnline/webAO into refactor-constants
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 +}; |
