Skip to content

electron vue project import ant-design-vue@2.0.1 #3735

@foreverhot

Description

@foreverhot
  • 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.
微信截图_20210301113112


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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions