Tri*_*leN 5 reactjs vite vitest
我正在尝试迁移vitest并面临问题。其中一项测试失败,因为它正在从依赖项之一读取 CommonJS 文件。在不使用 CommonJS 文件导入的其他测试中,运行不会失败
这就是我的defineConfig样子vitest.config.ts:
import graphql from '@rollup/plugin-graphql';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [
graphql(),
react()
],
test: {
environment: 'jsdom',
deps: {
registerNodeLoader: true,
fallbackCJS: true,
},
},
});
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js'
file extension and '/Users/nadavnassi/Desktop/dev/admin-client/node_modules/@rapidapi/ui-lib-icons/package.json'
contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1963 次 |
| 最近记录: |