I have a class Vec2 which is used throughout my project. The function getBoundingBox() is unused:
let x = new Vec2();
export function getBoundingBox( prims, padding ) {
let min = new Vec2( null, null );
when I run webpack (config below), every instance of Vec2 in the collated file is replaced by Vec2_Vec2, while the unused call in getBoundingBox() remains as Vec2, like so:
let x = new Vec2_Vec2();
export function getBoundingBox( prims, padding ) {
let min = new Vec2( null, null );
The obvious fix is to remove the unused code, but I am curious if there is an option to automatically ignore unused code and not include it in the final output. My webpack config is below:
webpack 5.46.0
webpack-cli 4.7.2
{
entry: {
app: './build/app.js',
},
output: {
filename: '[name].js',
path: path.resolve('.', 'dist'),
},
devtool: 'inline-source-map',
optimization: {
minimize: false,
},
}