diff --git a/packages/vite/src/utils/generator-utils.ts b/packages/vite/src/utils/generator-utils.ts
index 9a7b7d1a378b2..da222717960b7 100644
--- a/packages/vite/src/utils/generator-utils.ts
+++ b/packages/vite/src/utils/generator-utils.ts
@@ -415,7 +415,11 @@ ${options.includeVitest ? '/// ' : ''}
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
- ${options.includeLib ? "import dts from 'vite-plugin-dts';" : ''}
+ ${
+ options.includeLib
+ ? `import dts from 'vite-plugin-dts';\nimport { join } from 'path';`
+ : ''
+ }
export default defineConfig({
plugins: [
@@ -436,7 +440,11 @@ ${options.includeVitest ? '/// ' : ''}
${options.includeVitest ? '/// ' : ''}
import { defineConfig } from 'vite';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
- ${options.includeLib ? "import dts from 'vite-plugin-dts';" : ''}
+ ${
+ options.includeLib
+ ? `import dts from 'vite-plugin-dts';\nimport { join } from 'path';`
+ : ''
+ }
export default defineConfig({
plugins: [