I have a babylon project with a webpack config which is very similar to yours but when i'm compiling files to dist, my babylonBundle.js is strangely heavier than it have to be. (4.9 Mo).
Do you have an idea of this ?
const path = require('path');
const fs = require('fs');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
// App directory
const appDirectory = fs.realpathSync(process.cwd());
module.exports = {
entry: {
app: path.resolve(appDirectory, "src/index.ts"),
},
output: {
filename: 'js/babylonBundle.js',
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [{
test: /\.(js|mjs|jsx|ts|tsx)$/,
loader: 'source-map-loader',
enforce: 'pre',
},
{
test: /\.tsx?$/,
loader: 'ts-loader'
},
{
test: /\.(png|jpg|gif|env|glb|stl|obj|mtl)$/i,
use: [{
loader: 'url-loader',
}, ],
},
]
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(appDirectory, "public/index.html"),
}),
new CopyPlugin({
patterns: [
{ from: 'assets', to: 'assets' },
],
}),
],
// Just for ammo
node: {
fs: 'empty'
}
}