Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Update css-loader-config.js #510

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/next-css/css-loader-config.js
Expand Up @@ -11,6 +11,7 @@ module.exports = (
extensions = [],
cssModules = false,
cssLoaderOptions = {},
extractCssChunksOptions = {},
dev,
isServer,
postcssLoaderOptions = {},
Expand All @@ -32,8 +33,10 @@ module.exports = (
}

if (!isServer && !extractCssInitialized) {
config.plugins.push(
new ExtractCssChunks({
const extractCssChunksOptionsConfig = Object.assign(
{},
extractCssChunksOptions.config,
{
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: dev
Expand All @@ -43,7 +46,11 @@ module.exports = (
? 'static/chunks/[name].chunk.css'
: 'static/chunks/[name].[contenthash:8].chunk.css',
hot: dev
})
}
);

config.plugins.push(
new ExtractCssChunks(extractCssChunksOptionsConfig)
)
extractCssInitialized = true
}
Expand Down
2 changes: 2 additions & 0 deletions packages/next-less/index.js
Expand Up @@ -13,6 +13,7 @@ module.exports = (nextConfig = {}) => {
const {
cssModules,
cssLoaderOptions,
extractCssChunksOptions,
postcssLoaderOptions,
lessLoaderOptions = {}
} = nextConfig
Expand All @@ -21,6 +22,7 @@ module.exports = (nextConfig = {}) => {
extensions: ['less'],
cssModules,
cssLoaderOptions,
extractCssChunksOptions,
postcssLoaderOptions,
dev,
isServer,
Expand Down