Last active
April 3, 2022 22:31
-
-
Save amw/bfcb52b2e05412e6775af53f9531f9d9 to your computer and use it in GitHub Desktop.
repro-webpack-bundle-tracker-109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/node_modules | |
/package-lock.json | |
/*.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const message = 'This is my test' | |
console.log(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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/" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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