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

Multiple Entry Points #141

Closed
Gillingham opened this issue May 29, 2015 · 15 comments
Closed

Multiple Entry Points #141

Gillingham opened this issue May 29, 2015 · 15 comments

Comments

@Gillingham
Copy link

Looking at the docs, it seems to assume that there's only one entry point. Are there plans to support multi-page apps that have multiple entry points?

@gaearon
Copy link
Owner

gaearon commented May 29, 2015

Just do it normally, but make sure each entry point has webpack/hot/only-dev-server, or hot updates inside it won't work.

{
  entryPointA: ['./entryPointA', 'webpack/hot/only-dev-server'],
  entryPointB: ['./entryPointB', 'webpack/hot/only-dev-server'],
  devServerClient: 'webpack-dev-server/client?http://0.0.0.0:3000'
}

@gaearon gaearon closed this as completed May 29, 2015
@gaearon
Copy link
Owner

gaearon commented May 29, 2015

(You're welcome to PR the docs!)

@Surreal9
Copy link

I've taken this approach to my app but it seems to trigger all of my entry points to be re-processed with every update. I'm used to working with webpack-dev-server where updating one file simply shows that one file was updated, but for some reason when I update a file when using this approach/syntax with react-hot-loader I get the same output in the console as I do when I first fire up the new RHL'd webpack-dev-server. Is there something I'm missing that could allow me to use multiple entry points, but not have all of the files re-checked by a single file update?

@gaearon
Copy link
Owner

gaearon commented Jun 12, 2015

@Surreal9 I don't know :-(. You can probably ask around in Webpack's Gitter room or repo.

@Gillingham
Copy link
Author

@Surreal9 Did you ever find more information or a resolution to that?

@Surreal9
Copy link

Unfortunately not really.. I basically decided there was no benefit to switching over my main project to RHL since it was taking just as long to 'hot-load' as it was in doing a plain old refresh which was already built in with webpack-dev-server (due to RHL re-building the entire bundle each time).

I have since re-visited RHL in a new project, but I unfortunately see the same behaviour, (of re-building the entire bundle every time), even though this project only uses a single entry point. I've just decided to live with it.

@Surreal9
Copy link

I was linked to webpack/webpack#669 though, which remains open, so maybe that's still related

@ghost
Copy link

ghost commented Apr 19, 2016

Just a quick note on here. I couldn't get it to work using the answer provided by gaeron (#141 (comment)).

But this worked:

{
  entryPointA: ['./entryPointA', 'webpack/hot/only-dev-server', 'webpack-dev-server/client?http://0.0.0.0:3000'],
  entryPointB: ['./entryPointB', 'webpack/hot/only-dev-server', 'webpack-dev-server/client?http://0.0.0.0:3000']
}

Since that worked, I didn't bother to look into why that worked while the answer given previously did not work.

@monochrome-yeh
Copy link

@gaearon good answer! you have solved my problem 👯

@JonathanGuo
Copy link

@dcefram This actually works. webpack-dev-server/client cannot be loaded as an individual entry. It has to be bundled into each entry.

@hkjpotato
Copy link

hkjpotato commented Jun 17, 2017

It is better not to separate hmr related code in a different entry chunk if you are developing with Django and using django-wepack-loader.
If you keep the entry structure of development.config and production.config the same, you don't need to modify the template to load different static files.

@Dimon70007
Copy link

I have fixed hot-reloading with multiple entry points in my project by removing babel-polyfill from all entries in webpack.config.dev.js and using config like in the example above/

@thylle
Copy link

thylle commented Dec 3, 2018

'webpack-dev-server/client?http://0.0.0.0:3000'

I had the same issue, added these lines but it didn't work. - Had to add (both) .js files to the index.html and then hot-reloading worked.

@SunShinewyf
Copy link

I have the same problem, any solutions?

@theKashey
Copy link
Collaborator

@SunShinewyf this problem shall not exists in 2020. Please refer to webpack-dev-server documentation. --hot should handle all cases.

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

No branches or pull requests

10 participants