father icon indicating copy to clipboard operation
father copied to clipboard

The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten

Open kakariko-village opened this issue 4 years ago • 6 comments

I got this error message when run "father build":

"The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten"

Context

  • Father Version: 2.29.2
  • Node Version: 12.16.1
  • Platform: MAC OS Catalina 10.15.4

kakariko-village avatar Apr 01 '20 07:04 kakariko-village

same problem, import @ant-design/icon image

zhangfu-git avatar Apr 14 '20 10:04 zhangfu-git

经过测试,用require就行了,比如: const { PlusCircleFilled } = require('@ant-design/icons');

caozihao avatar Jun 23 '20 09:06 caozihao

同样的问题 导入immutable.js

Build cjs with rollup The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten Error when using sourcemap for reporting an error: Can't resolve original location of error. ✖ error Error: 'OrderedSet' is not exported by node_modules/[email protected]@immutable/dist/immutable.js at error (/Users/lambda/code/my-draft-js/node_modules/[email protected]@rollup/dist/rollup.js:5363:30)

Topgt avatar Aug 08 '20 10:08 Topgt

@Topgt +1 same in https://github.com/ant-design/ant-design-icons

afc163 avatar Nov 13 '20 08:11 afc163

how to fix ?

LJJCherry avatar Jan 26 '21 08:01 LJJCherry

https://rollupjs.org/guide/en/#error-this-is-undefined https://github.com/rollup/rollup/issues/1518

xiaohuoni avatar Jan 25 '22 03:01 xiaohuoni

father 4 已发布,可尝试升级到最新版:https://github.com/umijs/father/blob/master/docs/guide/migrate.md

旧版本不再维护,感谢支持

PeachScript avatar Aug 31 '22 11:08 PeachScript