Skip to content

Commit af4c283

Browse files
committed
chore(upgrade css-loader):
1 parent ee15fe8 commit af4c283

File tree

3 files changed

+99
-158
lines changed

3 files changed

+99
-158
lines changed

index.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
const cssLoaderConfig = require('./css-loader-config')
1+
const cssLoaderConfig = require('./css-loader-config');
22

33
module.exports = (nextConfig = {}) => {
44
return Object.assign({}, nextConfig, {
55
webpack(config, options) {
66
if (!options.defaultLoaders) {
77
throw new Error(
8-
'This plugin is not compatible with Next.js versions below 5.0.0 https://err.sh/next-plugins/upgrade',
9-
)
8+
'This plugin is not compatible with Next.js versions below 5.0.0 https://err.sh/next-plugins/upgrade'
9+
);
1010
}
1111

12-
const { dev, isServer } = options
13-
const { cssLoaderOptions, postcssLoaderOptions } = nextConfig
12+
const { dev, isServer } = options;
13+
const { cssLoaderOptions, postcssLoaderOptions } = nextConfig;
1414

1515
const createStyleConfig = cssModules =>
1616
(options.defaultLoaders.css = cssLoaderConfig(config, {
@@ -19,35 +19,35 @@ module.exports = (nextConfig = {}) => {
1919
cssLoaderOptions,
2020
postcssLoaderOptions,
2121
dev,
22-
isServer,
23-
}))
22+
isServer
23+
}));
2424

2525
config.module.rules.push({
2626
test: /\.css$/,
2727
oneOf: [
2828
{
2929
resourceQuery: /CSSModulesDisable/,
30-
use: createStyleConfig(false),
30+
use: createStyleConfig(false)
3131
},
3232
{
33-
use: createStyleConfig(true),
34-
},
33+
use: createStyleConfig(true)
34+
}
3535
],
3636
issuer(issuer) {
3737
if (issuer.match(/pages[\\/]_document\.js$/)) {
3838
throw new Error(
39-
'You can not import CSS files in pages/_document.js, use pages/_app.js instead.',
40-
)
39+
'You can not import CSS files in pages/_document.js, use pages/_app.js instead.'
40+
);
4141
}
42-
return true
43-
},
44-
})
42+
return true;
43+
}
44+
});
4545

4646
if (typeof nextConfig.webpack === 'function') {
47-
return nextConfig.webpack(config, options)
47+
return nextConfig.webpack(config, options);
4848
}
4949

50-
return config
51-
},
52-
})
53-
}
50+
return config;
51+
}
52+
});
53+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"release": "standard-version"
99
},
1010
"dependencies": {
11-
"css-loader": "1.0.0",
11+
"css-loader": "^2.1.1",
1212
"extract-css-chunks-webpack-plugin": "^3.2.0",
1313
"extracted-loader": "1.0.4",
1414
"find-up": "2.1.0",

0 commit comments

Comments
 (0)