-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
419 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { fileURLToPath, URL } from 'node:url'; | ||
import { defineConfig } from 'vite'; | ||
import vue from '@vitejs/plugin-vue'; | ||
import { nodePolyfills } from 'vite-plugin-node-polyfills'; | ||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'; | ||
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'; | ||
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'; | ||
import mkcert from 'vite-plugin-mkcert'; | ||
import AutoImport from 'unplugin-auto-import/vite' | ||
import Components from 'unplugin-vue-components/vite' | ||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig(({ mode }) => { | ||
const config = { | ||
plugins: [ | ||
vue(), | ||
AutoImport({ | ||
resolvers: [ElementPlusResolver()], | ||
}), | ||
Components({ | ||
resolvers: [ElementPlusResolver()], | ||
}), | ||
nodePolyfills(), | ||
mkcert() | ||
], | ||
resolve: { | ||
alias: { | ||
'@': fileURLToPath(new URL('./src', import.meta.url)) | ||
} | ||
}, | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
// Node.js global to browser globalThis | ||
define: { | ||
global: 'globalThis' | ||
}, | ||
// Enable esbuild polyfill plugins | ||
plugins: [ | ||
NodeGlobalsPolyfillPlugin({ | ||
buffer: true, | ||
process: true | ||
}), | ||
NodeModulesPolyfillPlugin() | ||
] | ||
} | ||
}, | ||
build: { | ||
rollupOptions: { | ||
plugins: [ | ||
rollupNodePolyFill() | ||
] | ||
} | ||
} | ||
} | ||
|
||
if (mode === 'production') { | ||
// Add production specific config here if needed | ||
} | ||
|
||
return config | ||
}) |
Oops, something went wrong.