Closed
Description
With the following example, the registration.js
file will be created. Note that adding .css
to the middlewareScript's name will cause the correct behavior. If I have time I'll do a PR.
// Wrong behavior, doesn't remove the unwanted registration.js bundle
// Add '.css' to the middlewareScript output and it'll work correctly
const middlewareScript = 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&name='
const exports = {
'index': [
'./src/client/js/index.js',
'./src/client/css/index.scss'
],
'registration': [
'./src/client/css/registration.scss'
]
}
if (process.env.NODE_ENV === 'development') {
const entryPoints = Object.keys(exports)
entryPoints.forEach((entryPoint) => {
console.log(`Add middleware to ${entryPoint}`)
exports[entryPoint].push(`${middlewareScript}${entryPoint}`) // change to "${entryPoint}.css" for correct behavior
})
}
module.exports = exports