Skip to content

Commit

Permalink
fix(css): fix importLoaders which only applies to plain CSS imports
Browse files Browse the repository at this point in the history
close #2055
  • Loading branch information
yyx990803 committed Aug 7, 2018
1 parent 68aaa8f commit 4220835
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/@vue/cli-service/__tests__/css.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('default loaders', () => {
// assert css-loader options
expect(findOptions(config, lang, 'css')).toEqual({
sourceMap: false,
importLoaders: lang === 'css' ? 2 : 3
importLoaders: 2
})
})
// sass indented syntax
Expand All @@ -71,7 +71,7 @@ test('production defaults', () => {
expect(findLoaders(config, lang)).toEqual([extractLoaderPath, 'css', 'postcss'].concat(loader))
expect(findOptions(config, lang, 'css')).toEqual({
sourceMap: false,
importLoaders: lang === 'css' ? 2 : 3
importLoaders: 2
})
})
})
Expand All @@ -86,7 +86,7 @@ test('CSS Modules rules', () => {
})
LANGS.forEach(lang => {
const expected = {
importLoaders: lang === 'css' ? 1 : 2, // no postcss-loader
importLoaders: 1, // no postcss-loader
localIdentName: `[name]_[local]_[hash:base64:5]`,
sourceMap: false,
modules: true
Expand Down
3 changes: 1 addition & 2 deletions packages/@vue/cli-service/lib/config/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ module.exports = (api, options) => {
sourceMap,
importLoaders: (
1 + // stylePostLoader injected by vue-loader
hasPostCSSConfig +
!!loader
hasPostCSSConfig
)
}, loaderOptions.css)

Expand Down

0 comments on commit 4220835

Please sign in to comment.