Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
style: Enable mini-css-extract-plugin's esModule mode (#1514)
Browse files Browse the repository at this point in the history
This makes the loader part of `mini-css-extract-plugin` output JS using
ES modules syntax instead of CJS, allowing webpack's module concatenation
and tree shaking features to work more effectively:
https://github.com/webpack-contrib/mini-css-extract-plugin#esmodule

Fixes #1511.
  • Loading branch information
edmorley authored Jan 28, 2020
1 parent 5e9c89e commit 01f2727
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/style-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ neutrino.use(
modulesTest: /\.module.css$/,
extract: {
enabled: process.env.NODE_ENV === 'production',
loader: {},
loader: {
esModule: true,
},
plugin: {
filename:
process.env.NODE_ENV === 'production'
Expand Down
4 changes: 3 additions & 1 deletion packages/style-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports = (opts = {}) => neutrino => {
loaders: [],
extract: {
enabled: isProduction,
loader: {},
loader: {
esModule: true,
},
plugin: {
filename: isProduction
? 'assets/[name].[contenthash:8].css'
Expand Down

0 comments on commit 01f2727

Please sign in to comment.