fix(webpack): add exportOnlyLocals: true for css modules options in server build. (#3778)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
FL3NKEY 2022-04-07 14:51:10 +03:00 committed by GitHub
parent 02f16bf23e
commit 2bedebe5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,10 @@ function createCssLoadersRule (ctx: WebpackConfigContext, cssLoaderOptions) {
if (options.webpack.extractCSS) { if (options.webpack.extractCSS) {
if (ctx.isServer) { if (ctx.isServer) {
// https://webpack.js.org/loaders/css-loader/#exportonlylocals
if (cssLoader.options.modules) {
cssLoader.options.modules.exportOnlyLocals = cssLoader.options.modules.exportOnlyLocals ?? true
}
return [cssLoader] return [cssLoader]
} }