mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 06:35:10 +00:00
feat: allow selecting rspack
builder
This commit is contained in:
parent
4e06a0acf8
commit
1c323a8810
@ -47,6 +47,7 @@
|
||||
"@nuxt/test-utils": "workspace:*",
|
||||
"@nuxt/vite-builder": "workspace:*",
|
||||
"@nuxt/webpack-builder": "workspace:*",
|
||||
"@nuxt/rspack-builder": "workspace:*",
|
||||
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
||||
"@types/crawler": "^1.2.2",
|
||||
"@types/node": "^18.15.5",
|
||||
|
@ -266,7 +266,7 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
}
|
||||
|
||||
// Track components used to render for webpack
|
||||
if (nuxt.options.builder === '@nuxt/webpack-builder') {
|
||||
if (nuxt.options.builder === '@nuxt/webpack-builder' || nuxt.options.builder === '@nuxt/rspack-builder') {
|
||||
addPlugin(resolve(nuxt.options.appDir, 'plugins/preload.server'))
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ export default defineUntypedSchema({
|
||||
/**
|
||||
* The builder to use for bundling the Vue part of your application.
|
||||
*
|
||||
* @type {'vite' | 'webpack' | { bundle: (nuxt: typeof import('../src/types/nuxt').Nuxt) => Promise<void> }}
|
||||
* @type {'vite' | 'webpack' | 'rspack' | { bundle: (nuxt: typeof import('../src/types/nuxt').Nuxt) => Promise<void> }}
|
||||
*/
|
||||
builder: {
|
||||
$resolve: async (val, get) => {
|
||||
@ -17,6 +17,7 @@ export default defineUntypedSchema({
|
||||
const map: Record<string, string> = {
|
||||
vite: '@nuxt/vite-builder',
|
||||
webpack: '@nuxt/webpack-builder',
|
||||
rspack: '@nuxt/rspack-builder'
|
||||
}
|
||||
return map[val] || val || (await get('vite') === false ? map.webpack : map.vite)
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ export default defineUntypedSchema({
|
||||
*/
|
||||
inlineSSRStyles: {
|
||||
async $resolve(val, get) {
|
||||
if (val === false || (await get('dev')) || (await get('ssr')) === false || (await get('builder')) === '@nuxt/webpack-builder') {
|
||||
if (val === false || (await get('dev')) || (await get('ssr')) === false || (await get('builder')) === '@nuxt/webpack-builder' || (await get('builder')) === '@nuxt/rspack-builder') {
|
||||
return false
|
||||
}
|
||||
// Enabled by default for vite prod with ssr
|
||||
|
@ -88,7 +88,7 @@ export type NuxtConfigLayer = ConfigLayer<NuxtConfig & {
|
||||
/** Normalized Nuxt options available as `nuxt.options.*` */
|
||||
export interface NuxtOptions extends Omit<ConfigSchema, 'builder'> {
|
||||
sourcemap: Required<Exclude<ConfigSchema['sourcemap'], boolean>>
|
||||
builder: '@nuxt/vite-builder' | '@nuxt/webpack-builder' | { bundle: (nuxt: Nuxt) => Promise<void> }
|
||||
builder: '@nuxt/vite-builder' | '@nuxt/webpack-builder' | '@nuxt/rspack-builder' | { bundle: (nuxt: Nuxt) => Promise<void> }
|
||||
_layers: NuxtConfigLayer[]
|
||||
$schema: SchemaDefinition
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
export default defineNuxtConfig({
|
||||
|
||||
builder: 'rspack'
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user