pack: change vite.config.js to vite.config.ts
This commit is contained in:
1 parent
f6b899ab73
commit
fae296b454
1 file changed
@@ -0,0 +1,70 @@
|
||||
import { fileURLToPath } from 'url'
|
||||
import { defineConfig } from 'vite'
|
||||
import electronPlugin from 'vite-plugin-electron'
|
||||
import rendererPlugin from 'vite-plugin-electron-renderer'
|
||||
import eslintPlugin from 'vite-plugin-eslint'
|
||||
import vuetifyPlugin from 'vite-plugin-vuetify'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve, dirname } from 'path'
|
||||
import { builtinModules } from 'module'
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__VUE_I18N_FULL_INSTALL__: true,
|
||||
__VUE_I18N_LEGACY_API__: false,
|
||||
__INTLIFY_PROD_DEVTOOLS__: false
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'],
|
||||
alias: {
|
||||
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
|
||||
}
|
||||
},
|
||||
base: './',
|
||||
root: resolve('./src/renderer'),
|
||||
publicDir: resolve('./src/renderer/public'),
|
||||
build: {
|
||||
assetsDir: '', // See: https://github.com/electron-vite/electron-vite-vue/issues/287
|
||||
outDir: resolve('./dist')
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
// Docs: https://github.com/vuetifyjs/vuetify-loader
|
||||
vuetifyPlugin({
|
||||
autoImport: true
|
||||
}),
|
||||
// Docs: https://github.com/gxmari007/vite-plugin-eslint
|
||||
eslintPlugin(),
|
||||
// Docs: https://github.com/electron-vite/vite-plugin-electron
|
||||
electronPlugin([
|
||||
{
|
||||
entry: ['src/preload/index.ts'],
|
||||
vite: {
|
||||
build: {
|
||||
outDir: 'dist/preload'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: ['src/main/index.ts'],
|
||||
onstart: (options) => {
|
||||
options.startup(['.', '--no-sandbox'])
|
||||
},
|
||||
vite: {
|
||||
build: {
|
||||
assetsDir: '.',
|
||||
outDir: 'dist/main',
|
||||
rollupOptions: {
|
||||
external: ['electron', ...builtinModules]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]),
|
||||
rendererPlugin({
|
||||
nodeIntegration: true
|
||||
})
|
||||
]
|
||||
})
|
||||
Reference in new issue
Block a user