fix(vite): remove postcss-url and duplicate postcss-import (#23861)

This commit is contained in:
Daniel Roe 2023-10-25 09:38:01 +09:00 committed by GitHub
parent 995cba84a2
commit 8e44395d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 37 deletions

View File

@ -60,7 +60,6 @@
"hookable": "^5.5.3",
"pathe": "^1.1.1",
"pkg-types": "^1.0.3",
"postcss-import-resolver": "^2.0.0",
"std-env": "^3.4.3",
"ufo": "^1.3.1",
"unimport": "^3.4.0",

View File

@ -1,5 +1,3 @@
import { defu } from 'defu'
import createResolver from 'postcss-import-resolver'
import { defineUntypedSchema } from 'untyped'
export default defineUntypedSchema({
@ -11,29 +9,6 @@ export default defineUntypedSchema({
* @type {Record<string, any>}
*/
plugins: {
/**
* https://github.com/postcss/postcss-import
*/
'postcss-import': {
$resolve: async (val, get) => val !== false
? defu(val || {}, {
resolve: createResolver({
alias: { ...(await get('alias')) },
modules: [
await get('srcDir'),
await get('rootDir'),
...(await get('modulesDir'))
]
})
})
: val
},
/**
* https://github.com/postcss/postcss-url
*/
'postcss-url': {},
/**
* https://github.com/postcss/autoprefixer
*/

View File

@ -51,8 +51,6 @@
"perfect-debounce": "^1.0.0",
"pkg-types": "^1.0.3",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-url": "^10.1.3",
"rollup-plugin-visualizer": "^5.9.2",
"std-env": "^3.4.3",
"strip-literal": "^1.3.0",

View File

@ -45,6 +45,7 @@
"pify": "^6.1.0",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-import-resolver": "^2.0.0",
"postcss-loader": "^7.3.3",
"postcss-url": "^10.1.3",
"pug-plain-loader": "^1.1.0",

View File

@ -1,3 +1,4 @@
import createResolver from 'postcss-import-resolver'
import { createCommonJS } from 'mlly'
import { requireModule } from '@nuxt/kit'
import type { Nuxt } from '@nuxt/schema'
@ -39,6 +40,22 @@ export const getPostcssConfig = (nuxt: Nuxt) => {
}
const postcssOptions = defu({}, nuxt.options.postcss, {
plugins: {
/**
* https://github.com/postcss/postcss-import
*/
'postcss-import': {
resolve: createResolver({
alias: { ...nuxt.options.alias },
modules: nuxt.options.modulesDir
})
},
/**
* https://github.com/postcss/postcss-url
*/
'postcss-url': {}
},
sourceMap: nuxt.options.webpack.cssSourceMap,
// Array, String or Function
order: 'autoprefixerAndCssnanoLast'

View File

@ -438,9 +438,6 @@ importers:
pkg-types:
specifier: ^1.0.3
version: 1.0.3
postcss-import-resolver:
specifier: ^2.0.0
version: 2.0.0
std-env:
specifier: ^3.4.3
version: 3.4.3
@ -644,12 +641,6 @@ importers:
postcss:
specifier: ^8.4.31
version: 8.4.31
postcss-import:
specifier: ^15.1.0
version: 15.1.0(postcss@8.4.31)
postcss-url:
specifier: ^10.1.3
version: 10.1.3(postcss@8.4.31)
rollup-plugin-visualizer:
specifier: ^5.9.2
version: 5.9.2(rollup@3.29.4)
@ -774,6 +765,9 @@ importers:
postcss-import:
specifier: ^15.1.0
version: 15.1.0(postcss@8.4.31)
postcss-import-resolver:
specifier: ^2.0.0
version: 2.0.0
postcss-loader:
specifier: ^7.3.3
version: 7.3.3(postcss@8.4.31)(typescript@5.2.2)(webpack@5.89.0)