Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Hot module replacement #89

Closed
wants to merge 1 commit into from
Closed

Conversation

jantimon
Copy link

This pull request adds hot module replacement to the extract-text-webpack-plugin.

@BohdanTkachenko
Copy link

Any chance that this PR can be merged?

@jantimon
Copy link
Author

jantimon commented Oct 7, 2015

Also the documentation said that hot module replacement might be used in production @sokra told me in gitter that he doesn't plan to merge this feature as hmr works seamless without the extract-text-webpack plugin

@readme42
Copy link

Would love to use ExtractTextPlugin with HMR!

Scenario: multiple css-themes which are extracted to static css files.

@TrejGun
Copy link

TrejGun commented Jan 5, 2016

👍

@p0wl
Copy link

p0wl commented Jan 7, 2016

👍 maybe enable it via a configuration flag, so it is not a problem for people using hmr in production.

@Sinkler
Copy link

Sinkler commented Jan 10, 2016

👍

5 similar comments
@epsyl
Copy link

epsyl commented Jan 10, 2016

👍

@phpdude
Copy link

phpdude commented Jan 10, 2016

👍🏻

@Koshub
Copy link

Koshub commented Jan 10, 2016

👍

@ziogaschr
Copy link

👍

@valerymercury
Copy link

👍

@vladmiller
Copy link

👍 Indeed would be very useful feature.

@valerybugakov
Copy link

@jantimon can you please suggest how to use your patched version of extract-text-plugin with HMR? I tried your forked repo but it doesn't work for me :( Still getting:

[HMR] The following modules couldn't be hot updated: (They would need a full reload!)

@jantimon
Copy link
Author

@valerybugakov The merge request worked - but this was Jul 2015. As this won't be merged anyway I don't want to spent time on it.

@valerybugakov
Copy link

@jantimon are you using HMR for CSS right now somehow? Or just switched to another tool.

@jantimon
Copy link
Author

I disabled extract text plugin for hmr (in this example if config.dev is true):

module: {
    loaders: [{
    {
      test: /\.less$/,
      loader: ExtractTextPlugin.extract(
        "style",
        "css-loader",
        "less"
      )
    }],
   plugins: [
      new ExtractTextPlugin("static/styles.css", {
        disable: config.dev
   })

@dmydry
Copy link

dmydry commented Jan 21, 2016

👍 Merge it please

@TrejGun
Copy link

TrejGun commented Jan 22, 2016

@valerybugakov try this fork
https://github.com/TrejGun/extract-text-webpack-plugin

@valerybugakov
Copy link

@TrejGun ok, will try, thanks!

@TrejGun
Copy link

TrejGun commented Jan 26, 2016

:( doesn't work with eval but works with source-map

@jantimon
Copy link
Author

And inline-source-map

iominh added a commit to iominh/extract-text-webpack-plugin that referenced this pull request Apr 27, 2016
@bebraw bebraw mentioned this pull request Jan 21, 2017
@shepherdwind
Copy link

I just write a loader(css-hot-loader), which supprot hot module replacement for an extracted css file.

If you don't want use style-loader, maybe you should have a try.

@bebraw bebraw added this to the 2.1 features/fixes milestone Jan 28, 2017
@bebraw
Copy link
Contributor

bebraw commented Jan 28, 2017

@jantimon Are you still interested? I expect the PR might need some tweaks to make this work in 2 series.

@bebraw bebraw mentioned this pull request Jan 28, 2017
@jantimon
Copy link
Author

@bebraw thanks for picking this up but I abandoned the related project two years ago because of missing webpack features - the solution is quite simple so it might still work :)

@bebraw
Copy link
Contributor

bebraw commented Jan 28, 2017

@jantimon Alright. Let's leave this open for now in case someone wants to pick it up for a future release.

@joshwiens joshwiens force-pushed the master branch 2 times, most recently from 664e78c to 76a171d Compare January 28, 2017 22:40
@msuperina
Copy link

Hi I would like to pick up this one, and have 2 options to propose:

  • either modify the bundle each time an asset changes: at the moment "// removed by extract-text-webpack-plugin" is written, we could add the hash to this comment
    this way it is possible to call module.hot.accept("path/to/asset") in the client application, but then the client would have to manually handle the path of the external resource to reload
  • or add a step to the compilation process that takes the output filename and add to the bundle some code that would reload the external resource automatically, like the solution proposed
    Note that in both cases I would only modify the loader.js file, not the index.js
    Also, the code could be handled by a plugin if you prefer
    Finally, an option "hmr: true" could be added to the plugin configuration to enable this feature
    Can you tell me what you prefer before I create a PR please ?

@bebraw
Copy link
Contributor

bebraw commented Jan 29, 2017

@msuperina Latter sounds good to me especially since then the client doesn't need to worry about dealing with external resources.

@d3viant0ne Any thoughts on this?

@joshwiens
Copy link
Member

Definitely the latter imo.

@DanielBadan
Copy link

@msuperina Any progress with the PR?

@bebraw
Copy link
Contributor

bebraw commented Feb 16, 2017

@danielverejan Nah. We investigated it, but it's a tough problem (hard code). An interesting way to work around the problem is to go with extract-loader. It's not the same, but still worth a look.

@FrankFan
Copy link

This is a very useful feature.
It's better to be merged into next version.

@bebraw
Copy link
Contributor

bebraw commented Mar 6, 2017

If someone wants to work on this, please open a separate PR. It's a surprisingly tough problem to solve neatly.

@daryn-k
Copy link

daryn-k commented Jun 26, 2017

Why does not it work for me?

ERROR in ./src/components/App/bootstrap.css
eacthabr-appound Error: Cannot find module "C:site.dev
eactapp
ode_modulesextract-text-webpack-pluginhotModuleReplacement.js"

No idea why a path is such

@Plortinus
Copy link

Does HMR work in version3.0.0?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet