2018-07-08 10:20:46 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'production', // "production" | "development" | "none"
|
|
|
|
// Chosen mode tells webpack to use its built-in optimizations accordingly.
|
2018-07-08 13:47:40 +00:00
|
|
|
entry: ['babel-polyfill', './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-17 16:19:54 +00:00
|
|
|
filename: 'compiled.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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|