how to avoid '.next/static/commons/main-xxxx.js' change???
See original GitHub issuenext: 6.0.1-canary.2
just change a little code in page, the yarn build
.next/static/commons/main-xxxx.js
always change. How to avoid it?
like this, modify some text in page/page2.js
:
<div>Welcome to Page2 </div>
to <div>Welcome to Page2 ABC </div>
the .next/static/commons/main-xxxx.js
should not change when yarn build
but the main-6974e8617b50c9d0b1bf.js
changed to main-515736f6b9f5ff2e32e1.js
Does anyone know how to keep generated main-xxxx.js
not change when dependent library has no change?
I already try to rewrite the next.config.js
only process node_modules
file, but no luck:
const path = require('path')
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders }) => {
for (plugin of config.plugins) {
if (plugin['constructor']['name'] === 'CommonsChunkPlugin') {
plugin.minChunks = function (module, count) {
var needChunk = (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, './node_modules')
) === 0
)
if (needChunk) {
console.log("needChunk = ", module.resource)
}
return needChunk
}
break;
}
}
return config
},
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Issues - GitHub
next: 6.0.1-canary.2 just change a little code in page, the yarn build .next/static/commons/main-xxxx.js always change. How to avoid it?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wanna get like this
.next/static/commons/main.js
instead of.next/static/commons/main-xxxx.js
how to operate ?This won’t work with Next.js 7, and Next.js 7 implements records.json so hashes should be more stable now.