-
Notifications
You must be signed in to change notification settings - Fork 9
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
Avoid generating version file when ran with webpack-dev-server #2
Comments
I think it is fine, that file is written in development mode too. We have a code, which checks this file and suggest user to reload page. So we want, that it will work equally on dev and production |
Thanks for your comment @gugu! Good to know you're using this on your project :) With this change I'm planning on doing we'll still have the version file written to disk whenever you run Webpack, independently of the environment you pass is. This should be backwards compatible with your app, btw. What doesn't sound quite right atm is that we shouldn't have the version file generated when running webpack-dev-server — that is, on your local development environment, as all of the other generated files are served from memory. Do you mind telling me a lil bit more about ur approach to prompting users to refresh the page, just to make sure I won't be breaking ur app? Cheers! |
Oh, sorry, I misunderstood task |
Not a prob!! Will let u know when I roll out this change so that you can make sure we haven't broken your app 👍 |
I'm actually not seeing the file at all when using webpack-dev-server. It works great when I run production build script, generating the file exactly where it should be. But I don't see any evidence that the file is being generated when running in dev. From this thread, I would assume that the file would be actually getting written to disk (even if that's supposed to change in the future), but I don't see it. I also get a 404 when I attempt to access the file at the correct path on localhost from my code. Is there an option that I'm missing to make sure it still gets generated under these conditions? |
Hi @jcq, thanks for your message and sorry for the delay in my response. I've just put together an example to demo this behaviour when running webpack-dev-server. To give it a try, you can clone this repo, |
Right now the version file gets written to disk even when running
webpack-dev-server
. That shouldn't be the case.This seems to work just fine with Webpack 1 (seen here):
Basically the plugin's
apply
method receivescompiler
as its first argument. In the function above:However it seems
compiler.outputFileSystem.constructor.name
is alwaysNodeOutputFileSystem
for Webpack 2.More info on the
compiler
object on the official docs.Could also use
process.argv[1]
to get the path to the file being executed, but this won't work if Webpack Dev Server gets executed from the CLI. Should try to use a combination of the two:The text was updated successfully, but these errors were encountered: