mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-15 18:34:50 +00:00
73ba30fb69
* refactor: split out webpack and postcss build options * feat(schema): set nuxt3 builder in config * fix(schema): default postcss config file to false * chore: update lockfile * style: remove unused imports * refactor(webpack): remove (previously disabled) babel config * refactor: move shared vite options into schema * fix(schema): omit __NUXT_BASE__ from defaults * fix: move appDir-dependent options back to vite * refactor: split out virtual modules * refactor: extract compile/createDevMiddleware * refactor: further improvements * chore: remove `@nuxt/webpack-builder` dependency * chore: update lockfile * refactor: move `builder` option to top level * fix: bind close to watcher instance * chore: update lockfile * fix: create portal between postcss & build.postcss.postcssOptions * fix: remove duplicate * fix: revert * fix: use `postcss` directly * fix: import builder from rootDir * chore: dedupe webpack install * test: update fixture to use `builder` * fix: bind class in pify Co-authored-by: Pooya Parsa <pyapar@gmail.com>
32 lines
661 B
TypeScript
32 lines
661 B
TypeScript
import { requireModule } from '@nuxt/kit'
|
|
import type { Nuxt } from '@nuxt/schema'
|
|
import type { ViteOptions } from './vite'
|
|
import { distDir } from './dirs'
|
|
|
|
export function resolveCSSOptions (nuxt: Nuxt): ViteOptions['css'] {
|
|
const css: ViteOptions['css'] = {
|
|
postcss: {
|
|
plugins: []
|
|
}
|
|
}
|
|
|
|
const plugins = nuxt.options.postcss.plugins
|
|
|
|
for (const name in plugins) {
|
|
const opts = plugins[name]
|
|
if (!opts) {
|
|
continue
|
|
}
|
|
const plugin = requireModule(name, {
|
|
paths: [
|
|
...nuxt.options.modulesDir,
|
|
distDir
|
|
]
|
|
})
|
|
// @ts-ignore
|
|
css.postcss.plugins.push(plugin(opts))
|
|
}
|
|
|
|
return css
|
|
}
|