diff --git a/empty.js b/empty.js deleted file mode 100644 index 336ce12b..00000000 --- a/empty.js +++ /dev/null @@ -1 +0,0 @@ -export {} diff --git a/vite.config.ts b/vite.config.ts index dce02501..2dcb3b6c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,4 @@ -import path from 'node:path' -import { defineConfig, Plugin, UserConfig } from 'vite' +import { Plugin, mergeConfig } from 'vite' import base from './vite.preview.config' const genStub: Plugin = { @@ -14,15 +13,15 @@ const genStub: Plugin = { }, } -export default defineConfig({ - ...base, - plugins: [...(base as UserConfig).plugins!, genStub], +export default mergeConfig(base, { + plugins: [genStub], optimizeDeps: { // avoid late discovered deps include: [ 'path-browserify', 'onigasm', 'typescript', + '@volar/cdn', '@vue/language-service', 'monaco-editor-core/esm/vs/editor/editor.worker', '@volar/monaco/worker', @@ -30,12 +29,6 @@ export default defineConfig({ ], }, base: './', - resolve: { - alias: { - typescript: path.resolve(__dirname, './empty.js'), - path: 'path-browserify', - }, - }, build: { target: 'esnext', minify: false, diff --git a/vite.preview.config.ts b/vite.preview.config.ts index a42dc65b..ad330139 100644 --- a/vite.preview.config.ts +++ b/vite.preview.config.ts @@ -1,4 +1,3 @@ -import path from 'node:path' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import replace from '@rollup/plugin-replace' @@ -13,10 +12,14 @@ export default defineConfig({ ], resolve: { alias: { - typescript: path.resolve(__dirname, './empty.js'), path: 'path-browserify', }, }, + build: { + commonjsOptions: { + ignore: ['typescript'], + }, + }, worker: { format: 'es', plugins: [