pack: change vite.config.ts config

This commit is contained in:
leejooy96 committed 2023-03-12 15:09:51 +09:00
1 parent 56b158ff67
commit 1df8fdb26a
2 files changed
+202 -5892

No files matched your search

+144 -5839
View File
File diff suppressed because it is too large. Load diff
+58 -53
View File
@@ -10,63 +10,68 @@ import { rmSync } from 'fs'
import { resolve, dirname } from 'path' import { resolve, dirname } from 'path'
import { builtinModules } from 'module' import { builtinModules } from 'module'
rmSync('dist', { recursive: true, force: true }) export default defineConfig(() => {
rmSync('dist', { recursive: true, force: true })
export default defineConfig({ return {
define: { define: {
__VUE_I18N_FULL_INSTALL__: true, __VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false, __VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false __INTLIFY_PROD_DEVTOOLS__: false
}, },
resolve: { resolve: {
extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'], extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'],
alias: { alias: {
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src') '@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
} }
}, },
base: './', base: './',
root: resolve('./src/renderer'), root: resolve('./src/renderer'),
publicDir: resolve('./src/renderer/public'), publicDir: resolve('./src/renderer/public'),
clearScreen: false, clearScreen: false,
build: { build: {
assetsDir: '', // See: https://github.com/electron-vite/electron-vite-vue/issues/287 assetsDir: '', // See: https://github.com/electron-vite/electron-vite-vue/issues/287
outDir: resolve('./dist') outDir: resolve('./dist')
}, },
plugins: [ plugins: [
vue(), vue(),
vueJsx(), vueJsx(),
// Docs: https://github.com/vuetifyjs/vuetify-loader // Docs: https://github.com/vuetifyjs/vuetify-loader
vuetifyPlugin({ vuetifyPlugin({
autoImport: true autoImport: true
}), }),
// Docs: https://github.com/gxmari007/vite-plugin-eslint // Docs: https://github.com/gxmari007/vite-plugin-eslint
eslintPlugin(), eslintPlugin(),
// Docs: https://github.com/electron-vite/vite-plugin-electron // Docs: https://github.com/electron-vite/vite-plugin-electron
electronPlugin([ electronPlugin([
{ {
entry: ['src/preload/index.ts'], entry: ['src/main/index.ts'],
vite: { onstart: (options) => {
build: { options.startup()
outDir: 'dist/preload' },
vite: {
build: {
assetsDir: '.',
outDir: 'dist/main',
rollupOptions: {
external: ['electron', ...builtinModules]
}
}
} }
}
},
{
entry: ['src/main/index.ts'],
onstart: (options) => {
options.startup(['.', '--no-sandbox'])
}, },
vite: { {
build: { entry: ['src/preload/index.ts'],
assetsDir: '.', onstart: (options) => {
outDir: 'dist/main', options.reload()
rollupOptions: { },
external: ['electron', ...builtinModules] vite: {
build: {
outDir: 'dist/preload'
} }
} }
} }
} ]),
]), rendererPlugin()
rendererPlugin() ]
] }
}) })