-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
2.0.1
Environment
Electron11.x Vue2.x
Reproduction link
https://2x.antdv.com/docs/vue/getting-started-cn
Steps to reproduce
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
Vue.use(Antd)
What is expected?
normal
What is actually happening?
Uncaught Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\aya\Desktop\electron-ts-template\node_modules\lodash-es\isPlainObject.js
require() of ES modules is not supported.
require() of C:\Users\aya\Desktop\electron-ts-template\node_modules\lodash-es\isPlainObject.js from C:\Users\aya\Desktop\electron-ts-template\node_modules\ant-design-vue\lib_util\props-util\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename isPlainObject.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\aya\Desktop\electron-ts-template\node_modules\lodash-es\package.json.

But I can't specify the type in packahe.json