Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HMR and miscellaneous non-JS entries #12

Closed
jcontonio opened this issue Feb 6, 2019 · 3 comments · Fixed by portway/portway#219
Closed

Support HMR and miscellaneous non-JS entries #12

jcontonio opened this issue Feb 6, 2019 · 3 comments · Fixed by portway/portway#219
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jcontonio
Copy link

jcontonio commented Feb 6, 2019

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
@fqborges
Copy link
Owner

fqborges commented Feb 7, 2019

Hello, I got the problem and your use case.

Probably an option for ignoring resources in the entry point, by matching a regex for example, would do. What do you propose?

Also, there is already a somewhat similar request on #7 for adding an include/exclude options to the config.

@jcontonio
Copy link
Author

#7 sounds like a good, flexible solution. Passing a regex to exclude/include would be great 👍

@fqborges fqborges added help wanted Extra attention is needed good first issue Good for newcomers labels May 7, 2019
@fqborges
Copy link
Owner

It should be working on v0.3.0 with the new ignore option.

see: https://www.npmjs.com/package/webpack-fix-style-only-entries#i-use-webpack-hot-middleware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants