feat: external dependencies

This commit is contained in:
草鞋没号 2022-01-05 09:09:16 +08:00
parent 252a5eefed
commit fc93d313fa
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import { join } from 'path' import { join } from 'path'
import { builtinModules } from 'module' import { builtinModules } from 'module'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import pkg from '../package.json'
export default defineConfig({ export default defineConfig({
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV,
@ -15,8 +16,9 @@ export default defineConfig({
emptyOutDir: true, emptyOutDir: true,
rollupOptions: { rollupOptions: {
external: [ external: [
...builtinModules,
'electron', 'electron',
...builtinModules,
...Object.keys((pkg as Record<string, any>).dependencies || {}),
], ],
output: { output: {
entryFileNames: '[name].cjs', entryFileNames: '[name].cjs',

View File

@ -1,6 +1,7 @@
import { join } from 'path' import { join } from 'path'
import { builtinModules } from 'module' import { builtinModules } from 'module'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import pkg from '../package.json'
export default defineConfig({ export default defineConfig({
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV,
@ -15,8 +16,9 @@ export default defineConfig({
emptyOutDir: true, emptyOutDir: true,
rollupOptions: { rollupOptions: {
external: [ external: [
...builtinModules,
'electron', 'electron',
...builtinModules,
...Object.keys((pkg as Record<string, any>).dependencies || {}),
], ],
output: { output: {
entryFileNames: '[name].cjs', entryFileNames: '[name].cjs',