Closed tianyingchun closed 1 year ago
"compilerOptions": { "esModuleInterop": true, "module": "NodeNext", "target": "ESNext", "moduleResolution": "NodeNext", "baseUrl": "./src", "noImplicitAny": false, "allowJs": false, "noEmit": false, "incremental": true, "paths": { "@/test-utils": ["./test-utils/index.js"], "@/test-utils/*": ["./test-utils/*"],
import { runCliMock } from '@/test-utils/cli-run-mock.js';
it will throw Error: [vite-node] Failed to load @/test-utils/cli-run-mock.js
[vite-node] Failed to load @/test-utils/cli-run-mock.js
if use import { runCliMock } from '@/test-utils/cli-run-mock without .js endfix it works
import { runCliMock } from '@/test-utils/cli-run-mock
.js
but in type:module nodeNext we must always using .js
type:module
Duplicate of #54
import { runCliMock } from '@/test-utils/cli-run-mock.js';
it will throw Error:
[vite-node] Failed to load @/test-utils/cli-run-mock.js
if use
import { runCliMock } from '@/test-utils/cli-run-mock
without.js
endfix it worksbut in
type:module
nodeNext we must always using.js