Skip to content

Instantly share code, notes, and snippets.

@amw
Last active April 3, 2022 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amw/bfcb52b2e05412e6775af53f9531f9d9 to your computer and use it in GitHub Desktop.
Save amw/bfcb52b2e05412e6775af53f9531f9d9 to your computer and use it in GitHub Desktop.
repro-webpack-bundle-tracker-109
/node_modules
/package-lock.json
/*.gz
const message = 'This is my test'
console.log(message)
{
"scripts": {
"build": "webpack && cat webpack-stats.json"
},
"devDependencies": {
"compression-webpack-plugin": "^9.2.0",
"webpack": "^5.71.0",
"webpack-bundle-tracker": "^1.4.0",
"webpack-cli": "^4.9.2"
}
}
{
"status": "done",
"assets": {
"main-ac5703ff529608b52267.js.gz": {
"name": "main-ac5703ff529608b52267.js.gz",
"path": "/Users/amw/Projects/repro-webpack-bundle-tracker-109/main-ac5703ff529608b52267.js.gz",
"publicPath": "/static/main-ac5703ff529608b52267.js.gz"
}
},
"chunks": {
"main": []
},
"publicPath": "/static/"
}
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const CompressionPlugin = require('compression-webpack-plugin')
module.exports = (env = {}, _argv = null) => {
const plugins = [
new CompressionPlugin({
minRatio: 10000, // make sure our small index is compressed
deleteOriginalAssets: true,
}),
new BundleTracker({
path: __dirname,
filename: './webpack-stats.json',
}),
]
const config = {
mode: 'production',
entry: {
'main': './index.js',
},
output: {
filename: `[name]-[contenthash].js`,
path: __dirname,
publicPath: '/static/',
},
plugins,
}
return config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment