2018-07-08 10:20:46 +00:00
|
|
|
const path = require('path');
|
2019-07-17 10:41:48 +00:00
|
|
|
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
|
|
const CompressionPlugin = require('compression-webpack-plugin');
|
2018-07-08 10:20:46 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2019-06-16 20:57:50 +00:00
|
|
|
plugins: [
|
2019-07-17 10:41:48 +00:00
|
|
|
new CompressionPlugin(),
|
2019-06-16 20:57:50 +00:00
|
|
|
],
|
2018-07-08 10:20:46 +00:00
|
|
|
mode: 'production', // "production" | "development" | "none"
|
|
|
|
// Chosen mode tells webpack to use its built-in optimizations accordingly.
|
2018-07-22 16:31:28 +00:00
|
|
|
entry: {
|
2019-01-04 14:18:03 +00:00
|
|
|
bundled: ['@babel/polyfill', './src/bowser.js'],
|
2018-07-22 16:31:28 +00:00
|
|
|
es5: './src/bowser.js',
|
|
|
|
}, // string | object | array
|
2018-07-08 10:20:46 +00:00
|
|
|
// defaults to ./src
|
|
|
|
// Here the application starts executing
|
|
|
|
// and webpack starts bundling
|
|
|
|
output: {
|
|
|
|
// options related to how webpack emits results
|
2018-07-17 16:19:54 +00:00
|
|
|
path: path.resolve(__dirname, './'), // string
|
2018-07-08 10:20:46 +00:00
|
|
|
// the target directory for all output files
|
|
|
|
// must be an absolute path (use the Node.js path module)
|
2018-07-22 16:31:28 +00:00
|
|
|
filename: '[name].js', // string
|
2018-07-08 10:20:46 +00:00
|
|
|
// the filename template for entry chunks
|
|
|
|
library: 'bowser',
|
|
|
|
libraryTarget: 'umd', // universal module definition
|
|
|
|
// the type of the exported library
|
|
|
|
globalObject: 'this',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
// configuration regarding modules
|
|
|
|
rules: [
|
|
|
|
// rules for modules (configure loaders, parser options, etc.)
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|