refactor: style-loader in dev for HMR happiness
This commit is contained in:
parent
ee3719858a
commit
5fc4c897f6
|
@ -60,7 +60,7 @@ module.exports = (async () => {
|
|||
const styleChunk = compilation.chunks.find((chunk) => (
|
||||
chunk.chunkReason?.match(/split chunk \(cache group: styles\)/)
|
||||
));
|
||||
if (styleChunk) {
|
||||
if (isProduction && styleChunk) {
|
||||
const modules = styleChunk.getModules();
|
||||
const styleFileHref = join(
|
||||
compilation.options.output.publicPath,
|
||||
|
|
|
@ -17,13 +17,13 @@ export default {
|
|||
neutrino.use(
|
||||
styleLoader({
|
||||
extract: {
|
||||
enabled: 'http' === target,
|
||||
enabled: isProduction && 'http' === target,
|
||||
},
|
||||
modules: {
|
||||
localIdentName: isProduction ? '[hash]' : '[path][name]__[local]',
|
||||
},
|
||||
style: {
|
||||
injectType: 'lazyStyleTag',
|
||||
injectType: 'http' === target ? 'styleTag' : 'lazyStyleTag',
|
||||
},
|
||||
test: /\.(c|s[ac])ss$/,
|
||||
modulesTest: /\.module\.(c|s[ac])ss$/,
|
||||
|
|
Loading…
Reference in New Issue
Block a user