mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
feat(vite): pass vue options to vite plugin (#1452)
This commit is contained in:
parent
3761b064d0
commit
c672d8990a
@ -7,16 +7,21 @@ export default {
|
||||
/** Vue.js config */
|
||||
vue: {
|
||||
/**
|
||||
* Properties that will be set directly on `Vue.config` for vue@2 and `app.config` for vue@3.
|
||||
* Properties that will be set directly on `Vue.config` for vue@2.
|
||||
*
|
||||
* @see [vue@2 Documentation](https://vuejs.org/v2/api/#Global-Config)
|
||||
* @see [vue@3 Documentation](https://v3.vuejs.org/api/application-config.html)
|
||||
* @version 2
|
||||
*/
|
||||
config: {
|
||||
silent: { $resolve: (val, get) => val ?? !get('dev') },
|
||||
performance: { $resolve: (val, get) => val ?? get('dev') }
|
||||
}
|
||||
performance: { $resolve: (val, get) => val ?? get('dev') },
|
||||
},
|
||||
/**
|
||||
* Options for the Vue compiler that will be passed at build time
|
||||
* @see [documentation](https://v3.vuejs.org/api/application-config.html)
|
||||
* @version 3
|
||||
*/
|
||||
compilerOptions: {}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -228,7 +228,8 @@ export default {
|
||||
source: 'src',
|
||||
object: 'src',
|
||||
embed: 'src'
|
||||
}
|
||||
},
|
||||
compilerOptions: { $resolve: (val, get) => val ?? get('vue.compilerOptions') },
|
||||
},
|
||||
css: {
|
||||
importLoaders: 0,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { resolve } from 'pathe'
|
||||
import * as vite from 'vite'
|
||||
import consola from 'consola'
|
||||
import vitePlugin from '@vitejs/plugin-vue'
|
||||
import vuePlugin from '@vitejs/plugin-vue'
|
||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||
import type { Connect } from 'vite'
|
||||
|
||||
@ -39,7 +39,7 @@ export async function buildClient (ctx: ViteBuildContext) {
|
||||
plugins: [
|
||||
replace({ 'process.env': 'import.meta.env' }),
|
||||
cacheDirPlugin(ctx.nuxt.options.rootDir, 'client'),
|
||||
vitePlugin(ctx.config.vue),
|
||||
vuePlugin(ctx.config.vue),
|
||||
viteJsxPlugin()
|
||||
],
|
||||
server: {
|
||||
|
@ -68,7 +68,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
},
|
||||
plugins: [
|
||||
cacheDirPlugin(ctx.nuxt.options.rootDir, 'server'),
|
||||
vuePlugin(),
|
||||
vuePlugin(ctx.config.vue),
|
||||
viteJsxPlugin()
|
||||
]
|
||||
} as ViteOptions)
|
||||
|
@ -52,7 +52,11 @@ export async function bundle (nuxt: Nuxt) {
|
||||
}
|
||||
},
|
||||
base: nuxt.options.build.publicPath,
|
||||
vue: {},
|
||||
// TODO: move to kit schema when it exists
|
||||
vue: {
|
||||
isProduction: !nuxt.options.dev,
|
||||
template: { compilerOptions: nuxt.options.vue.compilerOptions }
|
||||
},
|
||||
css: resolveCSSOptions(nuxt),
|
||||
optimizeDeps: {
|
||||
exclude: [],
|
||||
|
Loading…
Reference in New Issue
Block a user