construction: Dual-builds for node and browser
This commit is contained in:
parent
d74ceaf9f2
commit
1f33804778
12 changed files with 7560 additions and 35 deletions
36
packages/brian/webpack.config.js
Normal file
36
packages/brian/webpack.config.js
Normal 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()
|
||||
]
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue