Skip to content

Commit 2292754

Browse files
committed
Avoid using __dirname in the Vite config
1 parent 16617c7 commit 2292754

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/create-vue-lib/src/template/base/config/packages/@projectName@/vite.config.mts.ejs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { resolve } from 'node:path'
2-
<%_ if (config.includeAtAliases) { _%>
31
import { fileURLToPath, URL } from 'node:url'
4-
<%_ } _%>
52

63
import { defineConfig, type UserConfig } from 'vite'
74
import replace from '@rollup/plugin-replace'
@@ -64,7 +61,7 @@ export default defineConfig(({ mode }): UserConfig => {
6461
minify: mode === 'production',
6562
6663
lib: {
67-
entry: resolve(__dirname, 'src/index.ts'),
64+
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
6865
name: '<%- config.globalVariableName %>',
6966
formats: mode === 'neutral' ? ['cjs', 'es'] : ['es', 'iife'],
7067
cssFileName: mode === 'production' ? '<%- config.unscopedPackageName %>.prod' : '<%- config.unscopedPackageName %>',

0 commit comments

Comments
 (0)