Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit d4ae5be

Browse files
authored
fix(#84): Move postcss-modules plugins to last (#86)
1 parent c4bcd40 commit d4ae5be

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/compiler.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,24 @@ export class SFCCompiler {
229229
style.module === true || typeof style.module === 'string'
230230
const needsCleanCSS =
231231
this.template.isProduction && !(this.style.postcssCleanOptions && this.style.postcssCleanOptions.disabled)
232-
const postcssPlugins = [
233-
needsCSSModules
234-
? postcssModules({
235-
generateScopedName: '[path][local]-[hash:base64:4]',
236-
...this.style.postcssModulesOptions,
237-
getJSON: (t: any) => {
238-
tokens = t
239-
}
240-
})
241-
: undefined,
242-
needsCleanCSS
243-
? postcssClean(this.style.postcssCleanOptions)
244-
: undefined
245-
]
246-
.concat(this.style.postcssPlugins)
232+
const postcssPlugins = (this.style.postcssPlugins || [])
233+
.slice()
234+
.concat([
235+
needsCleanCSS
236+
? postcssClean(this.style.postcssCleanOptions)
237+
: undefined,
238+
needsCSSModules
239+
? postcssModules({
240+
generateScopedName: '[path][local]-[hash:base64:4]',
241+
...this.style.postcssModulesOptions,
242+
getJSON: (t: any) => {
243+
tokens = t
244+
}
245+
})
246+
: undefined,
247+
])
247248
.filter(Boolean)
249+
248250
const preprocessOptions =
249251
(style.lang &&
250252
this.style.preprocessOptions &&

0 commit comments

Comments
 (0)