Skip to content

Commit 118253e

Browse files
authored
fix: update to cssnano 5 (#357)
1 parent a03c7bf commit 118253e

File tree

4 files changed

+3087
-3455
lines changed

4 files changed

+3087
-3455
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"jest": "^26.6.3",
4545
"less": "^3.12.2",
4646
"node-sass": "^5.0.0",
47-
"postcss": "^8.1.14",
47+
"postcss": "^8.2.7",
4848
"rollup": "^2.34.2",
4949
"stylus": "^0.54.8",
5050
"sugarss": "^3.0.3",
@@ -53,7 +53,7 @@
5353
"dependencies": {
5454
"chalk": "^4.1.0",
5555
"concat-with-sourcemaps": "^1.1.0",
56-
"cssnano": "^4.1.10",
56+
"cssnano": "^5.0.1",
5757
"import-cwd": "^3.0.0",
5858
"p-queue": "^6.6.2",
5959
"pify": "^5.0.0",
@@ -103,4 +103,4 @@
103103
"next"
104104
]
105105
}
106-
}
106+
}

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export default (options = {}) => {
224224
let { code, codeFileName, map, mapFileName } = getExtracted()
225225
// Perform cssnano on the extracted file
226226
if (postcssLoaderOptions.minimize) {
227-
const cssOptions = postcssLoaderOptions.minimize
227+
const cssOptions = {}
228228
cssOptions.from = codeFileName
229229
if (sourceMap === 'inline') {
230230
cssOptions.map = { inline: true }
@@ -233,7 +233,7 @@ export default (options = {}) => {
233233
cssOptions.to = codeFileName
234234
}
235235

236-
const result = await require('cssnano').process(code, cssOptions)
236+
const result = await require('cssnano')(postcssLoaderOptions.minimize).process(code, cssOptions)
237237
code = result.css
238238

239239
if (sourceMap === true && result.map && result.map.toString) {

0 commit comments

Comments
 (0)