45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
|
const path = require('path')
|
|
|
|
module.exports = {
|
|
entry: {
|
|
bundle: './src/index.js',
|
|
loadChart: './src/loadChart.js',
|
|
results: './src/results.js'
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: '[name].js'
|
|
},
|
|
module: {
|
|
// Suppress warnings and errors logged by benchmark.js when bundled using webpack.
|
|
noParse: [path.resolve(__dirname, './node_modules/benchmark/benchmark.js')],
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
loaders: ['babel-loader'],
|
|
exclude: [/node_modules/, /data/]
|
|
},
|
|
{
|
|
test: /\.wasm$/,
|
|
type: 'javascript/auto',
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: '[name].[hash:5].[ext]'
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [new CleanWebpackPlugin(), new CopyPlugin([{ from: 'public' }])],
|
|
devtool: 'source-map',
|
|
// to make webpack work with emscripten js files
|
|
target: 'web',
|
|
node: {
|
|
__dirname: false,
|
|
fs: 'empty',
|
|
Buffer: false,
|
|
process: false
|
|
}
|
|
}
|