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

Commit

Permalink
fix(css-loader): add import loaders count
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois-Esquire authored Jul 17, 2020
1 parent 7bbdccb commit 6efe354
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports[`Common webpack loaders css-loader should still return a good localIdent
Object {
"loader": "css-loader",
"options": Object {
"importLoaders": 2,
"modules": Object {
"localIdentName": "[name]__[local]___[hash:base64:5]",
},
Expand All @@ -37,6 +38,7 @@ exports[`Common webpack loaders css-loader should use the chunk name in the loca
Object {
"loader": "css-loader",
"options": Object {
"importLoaders": 2,
"modules": Object {
"localIdentName": "my-chunk__[name]__[local]___[hash:base64:5]",
},
Expand All @@ -48,6 +50,7 @@ exports[`Common webpack loaders css-loader should use the css-loader 1`] = `
Object {
"loader": "css-loader",
"options": Object {
"importLoaders": 2,
"modules": Object {
"localIdentName": "[name]__[local]___[hash:base64:5]",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/one-app-bundler/webpack/app/webpack.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = (babelEnv) => merge(
test: /\.s?css$/,
use: [
{ loader: 'style-loader' },
cssLoader(),
cssLoader({ importLoaders: 1 }),
sassLoader(),
],
},
Expand Down
3 changes: 2 additions & 1 deletion packages/one-app-bundler/webpack/loaders/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ const getConfigOptions = require('../../utils/getConfigOptions');

const packageRoot = process.cwd();

const cssLoader = ({ name = '' } = {}) => ({
const cssLoader = ({ name = '', importLoaders = 2 } = {}) => ({
loader: 'css-loader',
options: {
importLoaders,
modules: {
localIdentName: `${name && `${name}__`}[name]__[local]___[hash:base64:5]`,
},
Expand Down

0 comments on commit 6efe354

Please sign in to comment.