- 问题:
更新 Element-plus 后,运行时需要安装@popperjs/core
依赖。
如果正常执行npm install @popperjs/core
,那么,打包时,就会出现下面报错。Named export ‘placements’ not found. The requested module ‘@popperjs/core’ is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: import pkg from ‘@popperjs/core’; const { placements, createPopper } = pkg;
- 解决:
把 node_modules 删除,在 package.json 把 “@popperjs/core” 版本号改为"@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7"
(esm 的包)重新npm install
,即可。
参考 element-plus/package.json