2022-02-25 19:11:01 +00:00
|
|
|
import { resolve } from 'pathe'
|
2022-07-21 10:44:33 +00:00
|
|
|
import { withoutLeadingSlash } from 'ufo'
|
2022-02-25 19:11:01 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
/**
|
|
|
|
* Configuration that will be passed directly to Vite.
|
|
|
|
*
|
|
|
|
* See https://vitejs.dev/config for more information.
|
|
|
|
* Please note that not all vite options are supported in Nuxt.
|
|
|
|
*
|
2022-07-29 10:57:45 +00:00
|
|
|
* @type {typeof import('../src/types/config').ViteConfig}
|
2022-02-25 19:11:01 +00:00
|
|
|
* @version 3
|
|
|
|
*/
|
|
|
|
vite: {
|
|
|
|
root: {
|
|
|
|
$resolve: (val, get) => val ?? get('srcDir'),
|
|
|
|
},
|
|
|
|
mode: {
|
2022-06-03 14:09:04 +00:00
|
|
|
$resolve: (val, get) => val ?? (get('dev') ? 'development' : 'production'),
|
2022-02-25 19:11:01 +00:00
|
|
|
},
|
|
|
|
logLevel: 'warn',
|
|
|
|
define: {
|
|
|
|
$resolve: (val, get) => ({
|
|
|
|
'process.dev': get('dev'),
|
|
|
|
...val || {}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
|
|
|
},
|
|
|
|
publicDir: {
|
|
|
|
$resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public),
|
|
|
|
},
|
|
|
|
vue: {
|
|
|
|
isProduction: {
|
|
|
|
$resolve: (val, get) => val ?? !get('dev'),
|
|
|
|
},
|
|
|
|
template: { compilerOptions: {
|
|
|
|
$resolve: (val, get) => val ?? get('vue').compilerOptions }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
optimizeDeps: {
|
|
|
|
exclude: {
|
|
|
|
$resolve: (val, get) => [
|
|
|
|
...val || [],
|
|
|
|
...get('build.transpile').filter(i => typeof i === 'string'),
|
|
|
|
'vue-demi'
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
esbuild: {
|
|
|
|
jsxFactory: 'h',
|
|
|
|
jsxFragment: 'Fragment',
|
|
|
|
tsconfigRaw: '{}'
|
|
|
|
},
|
|
|
|
clearScreen: false,
|
|
|
|
build: {
|
|
|
|
assetsDir: {
|
2022-07-21 10:44:33 +00:00
|
|
|
$resolve: (val, get) => val ?? withoutLeadingSlash(get('app').buildAssetsDir),
|
2022-02-25 19:11:01 +00:00
|
|
|
},
|
|
|
|
emptyOutDir: false,
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
fs: {
|
|
|
|
strict: false,
|
|
|
|
allow: {
|
|
|
|
$resolve: (val, get) => [
|
|
|
|
get('buildDir'),
|
|
|
|
get('srcDir'),
|
|
|
|
get('rootDir'),
|
|
|
|
...get('modulesDir'),
|
|
|
|
...val ?? []
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|