Closed
Description
I'm using vite v4.3.9 with vue v3.3.4 and vuetify v3.3.6. When I switch from node20 v1.0.1 to v1.0.2 I am now seeing similar errors to below:
vite.config.ts:2:30 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("vite")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to '/<myPath>/package.json'.
2 import { defineConfig } from 'vite';
~~~~~~
Found 116 errors in 42 files.
My vite.config.ts looks like:
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vuetify from 'vite-plugin-vuetify';
export default defineConfig({
build: {
target: 'esnext'
},
plugins: [
vue(),
vuetify({
autoImport: true,
}),
],
resolve: {
alias: {
// @ts-ignore
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host: '0.0.0.0',
port: 1234,
proxy: {
'/socket.io': {
target: 'ws://localhost:5678',
ws: true
},
},
hmr: {
path: "/socket.io",
port: 5678,
clientPort: 443,
},
watch: {
usePolling: true,
}
},
});
Metadata
Assignees
Labels
No labels