Skip to content

Commit 4220835

Browse files
committed
fix(css): fix importLoaders which only applies to plain CSS imports
close vuejs#2055
1 parent 68aaa8f commit 4220835

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/@vue/cli-service/__tests__/css.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ test('default loaders', () => {
5757
// assert css-loader options
5858
expect(findOptions(config, lang, 'css')).toEqual({
5959
sourceMap: false,
60-
importLoaders: lang === 'css' ? 2 : 3
60+
importLoaders: 2
6161
})
6262
})
6363
// sass indented syntax
@@ -71,7 +71,7 @@ test('production defaults', () => {
7171
expect(findLoaders(config, lang)).toEqual([extractLoaderPath, 'css', 'postcss'].concat(loader))
7272
expect(findOptions(config, lang, 'css')).toEqual({
7373
sourceMap: false,
74-
importLoaders: lang === 'css' ? 2 : 3
74+
importLoaders: 2
7575
})
7676
})
7777
})
@@ -86,7 +86,7 @@ test('CSS Modules rules', () => {
8686
})
8787
LANGS.forEach(lang => {
8888
const expected = {
89-
importLoaders: lang === 'css' ? 1 : 2, // no postcss-loader
89+
importLoaders: 1, // no postcss-loader
9090
localIdentName: `[name]_[local]_[hash:base64:5]`,
9191
sourceMap: false,
9292
modules: true

packages/@vue/cli-service/lib/config/css.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ module.exports = (api, options) => {
8282
sourceMap,
8383
importLoaders: (
8484
1 + // stylePostLoader injected by vue-loader
85-
hasPostCSSConfig +
86-
!!loader
85+
hasPostCSSConfig
8786
)
8887
}, loaderOptions.css)
8988

0 commit comments

Comments
 (0)