1
0
Fork 0

construction: Dual-builds for node and browser

This commit is contained in:
Joost De Cock 2018-07-15 18:57:27 +02:00
parent d74ceaf9f2
commit 1f33804778
12 changed files with 7560 additions and 35 deletions

View file

@ -0,0 +1,36 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'production',
target: 'web',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist/browser'),
filename: 'bundle.js',
libraryTarget: 'var',
library: 'brian'
},
module: {
rules:[
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
]
},
externals: {
// require('data') is external and available
// on the global var data
'data': 'data'
},
plugins: [
new HtmlWebpackPlugin()
]
};