This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 214
CSS extraction includes css-hot-loader even in production #802
Milestone
Comments
edmorley
added a commit
that referenced
this issue
Apr 20, 2018
Since the former is deprecated for CSS extraction, and is not compatible with webpack 4. The new plugin has a much simpler API: https://github.com/webpack-contrib/mini-css-extract-plugin I've also chosen to remove `css-hot-loader` - since it's unnecessary when using `style-loader` in development. ie option (2) from #802. (Once `mini-css-extract-plugin` supports HMR we can stop using `style-loader` entirely.) NB: `mini-css-extract-plugin` doesn't support having multiple plugin instances, so now we only have one instance for both standard CSS and module CSS. This will need testing to ensure everything still works.
edmorley
added a commit
that referenced
this issue
Apr 20, 2018
Since the former is deprecated for CSS extraction, and is not compatible with webpack 4. The new plugin has a much simpler API: https://github.com/webpack-contrib/mini-css-extract-plugin I've also chosen to remove `css-hot-loader` - since it's unnecessary when using `style-loader` in development. ie option (2) from #802. (Once `mini-css-extract-plugin` supports HMR we can stop using `style-loader` entirely.) NB: `mini-css-extract-plugin` doesn't support having multiple plugin instances, so now we only have one instance for both standard CSS and module CSS. This will need testing to ensure everything still works.
edmorley
added a commit
that referenced
this issue
Apr 20, 2018
Since the former is deprecated for CSS extraction, and is not compatible with webpack 4. The new plugin has a much simpler API: https://github.com/webpack-contrib/mini-css-extract-plugin I've also chosen to remove `css-hot-loader` - since it's unnecessary when using `style-loader` in development. ie option (2) from #802. (Once `mini-css-extract-plugin` supports HMR we can stop using `style-loader` entirely.) NB: `mini-css-extract-plugin` doesn't support having multiple plugin instances, so now we only have one instance for both standard CSS and module CSS. This will need testing to ensure everything still works.
edmorley
added a commit
that referenced
this issue
Apr 24, 2018
Since the former is deprecated for CSS extraction, and is not compatible with webpack 4. The new plugin has a much simpler API: https://github.com/webpack-contrib/mini-css-extract-plugin I've also chosen to remove `css-hot-loader` - since it's unnecessary when using `style-loader` in development. ie option (2) from #802. (Once `mini-css-extract-plugin` supports HMR we can stop using `style-loader` entirely.) NB: `mini-css-extract-plugin` doesn't support having multiple plugin instances, so now we only have one instance for both standard CSS and module CSS. This will need testing to ensure everything still works.
edmorley
added a commit
that referenced
this issue
Apr 25, 2018
Notable changes: * Major version updates of `webpack`, `webpack-dev-server` and `optimize-css-assets-webpack-plugin` * Uses the new webpack 4 `mode` option * Removed `@neutrinojs/chunk` in favour of the `splitChunks` feature * Removed `@neutrinojs/babel-minify` in favour of the faster `uglify-es` * Removed redundant `ModuleConcatenationPlugin` usage * Removed default of `NODE_ENV` from `@neutrinojs/env` * Replaced `extract-text-webpack-plugin` with `mini-css-extract-plugin` * Stopped pinning `webpack-sources` to v1.0.1 * Added checks to warn about changed web preset `minify` options * Added checks to enforce that users remove any legacy `vendor` entrypoints For more details on the webpack changes, see: https://github.com/webpack/webpack/releases/tag/v4.0.0 Fixes #737. Fixes #802. Closes #748. Closes #768. Closes #769. Closes #766.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The
web
preset supports extraction of CSS to a separate file as of #443, via@neutrinojs/style-loader
and thenextract-text-webpack-plugin
.The
extract-text-webpack-plugin
loader/plugin doesn't support HMR hot reloading itself (unlikestyle-loader
, which works since it's just JS) - so if one wants to use it in development, thencss-hot-loader
must be used alongside it.However at the moment the web preset:
https://github.com/mozilla-neutrino/neutrino-dev/blob/ee7b3d90fe93da0b6664b194da2994d4ce79f26e/packages/web/index.js#L37
css-hot-loader
whenever extraction is enabled, even if that's in production:https://github.com/mozilla-neutrino/neutrino-dev/blob/ee7b3d90fe93da0b6664b194da2994d4ce79f26e/packages/style-loader/index.js#L102-L104
This combination is confusing, since by default
css-hot-loader
is only being included in production - where it will never be used.We should either:
css-hot-loader
css-hot-reloader
entirelycss-hot-reloader
conditional on production too. (This would allow people to force extraction to be enabled in development, and yet still have working hot loading)Also relevant:
extract-text-webpack-plugin
doesn't support webpack 4 - so for that we're going to need to switch tomini-css-extract-plugin
. For now the latter also requires the use ofcss-hot-reloader
if being used in development, however it appears that they are hoping to add native support for HMR thereby makingcss-hot-reloader
redundant (Hot Reload plan? webpack-contrib/mini-css-extract-plugin#34).style-loader
)As such, I'm leaning towards option (2), with the understanding that we will likely enable extraction everywhere once
mini-css-extract-plugin
supports it natively.@timkelty @eliperelman - thoughts?
Whilst we're on this topic - it seems like we could improve the way we set default options. This issue in part exists because at the moment, we set the
style.extract
default according to production, but yet for thehot
option, we always set it totrue
and instead later use a.when()
clause to decide whether to invokedevServer
etc. But this means that@neutrinojs/style-loader
is passedhot: true
even in production. I was wondering too if we should move defaults one layer deeper? (ie in@neutrinojs/style-loader
)?The text was updated successfully, but these errors were encountered: