mirror of
https://github.com/wassname/rl_2d_walker.js.git
synced 2026-08-21 11:21:21 +08:00
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack')
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
|
|
var ENV = process.env.NODE_ENV || "development";
|
|
|
|
module.exports = {
|
|
entry: {
|
|
app: './src/index.js',
|
|
},
|
|
target: 'web',
|
|
devtool: ENV==="development"? 'dev-source-map': false,
|
|
output: {
|
|
path: path.join(__dirname, 'dist'),
|
|
filename: '[name].bundle.js',
|
|
},
|
|
optimization: {
|
|
splitChunks: {
|
|
cacheGroups: {
|
|
lib: {
|
|
test: /jsbox2d/,
|
|
chunks: 'initial',
|
|
name: 'lib',
|
|
priority:20,
|
|
enforce:true
|
|
},
|
|
vendors: {
|
|
test: /[\\/]node_modules[\\/]/,
|
|
chunks: 'initial',
|
|
name: 'vendor',
|
|
priority: 10,
|
|
enforce: true,
|
|
}
|
|
}
|
|
}
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({ template: '!!html-loader!src/index.html' }),
|
|
new CopyWebpackPlugin([
|
|
{ from: 'src/images', to: 'images' },
|
|
{ from: 'checkpoints', to: 'checkpoints' },
|
|
{from:'src/css',to:'css'}
|
|
|
|
]),
|
|
new webpack.DefinePlugin({
|
|
// A flag to disable node imports, and enable window/dom usage
|
|
WEB: true
|
|
}),
|
|
]
|
|
};
|