You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
ExtractTextPlugin doesn't generate any file when the application is launched from Visual Studio and the isDevBuild variable is set to false in webpack.config.js
#1229
Closed
rskopal opened this issue
Aug 25, 2017
· 2 comments
I use the React template and I would like to try to run my application in Visual Studio without HMR and without style-loader css to head injection. So I set the ASPNETCORE_ENVIRONMENT variable to Staging in the IIS Express and application debug configuration and set the isDevBuild const directly to false in the webpack.config.js. But when I launch the application from Visual Studio no dist/site.css file is generated. If I run the webpack command from command line, the site.css is generated correctly. The webpack.config.js is the same as in the React template except these lines:
By default, Webpack dev middleware (and hence the runtime webpack build) only runs when the application is in Development environment. If you want to perform a webpack build at some other time (e.g., when your application is in Staging environment), then it's up to you to do so manually, e.g., using webpack on the command line, or by publishing your application using dotnet publish or VS's "Publish" UI, which also performs a webpack build for you.
If you just want to turn off HMR, you only need to change the HotModuleReplacement = true option to false in the WebpackDevMiddlewareOptions in your Startup.cs. You don't have to change any Webpack config or which environment your application runs in.
Thanks for your answer, I didn't notice that the main.js wasn't also generated. I solved the problem by creating two launchSettings configurations in VS, IIS Express and IIS Express Staging, the latter one has the ASPNETCORE_ENVIRONMENT variable set to Staging. Because I'm afraid I'll forget to manually run webpack build after each switch to IIS Express Staging, I added this to the Startup:
It works well, but after each switching I also have to set the isDevBuild flag directly to false in the webpack.config.js. It would be nice if I could send some parameters to webpack from the Startup, as it is mentioned in comments for the createWebpackDevServer() function in WebpackDevMiddleware.ts or here #816, e.g.:
I use the React template and I would like to try to run my application in Visual Studio without HMR and without style-loader css to head injection. So I set the ASPNETCORE_ENVIRONMENT variable to Staging in the IIS Express and application debug configuration and set the isDevBuild const directly to false in the webpack.config.js. But when I launch the application from Visual Studio no dist/site.css file is generated. If I run the webpack command from command line, the site.css is generated correctly. The webpack.config.js is the same as in the React template except these lines:
Is there any problem with the ExtractTextPlugin when webpack build is run from Visual Studio?
The text was updated successfully, but these errors were encountered: