felixge / felixge/node-dateformat

dateformat not working with "require" ?

未關閉
#176 8 則留言 9 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
1.3k
分支
155
PR 合併指標
30 天內沒有已合併 PR

描述

using import I get this error
```SyntaxError: Cannot use import statement outside a module```
while using require this error
```
Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/html/wikisphere-nodejs/node_modules/dateformat/lib/dateformat.js from /var/www/html/wikisphere-nodejs/fetch.js not supported.
Instead change the require of dateformat.js in /var/www/html/wikisphere-nodejs/fetch.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/var/www/html/wikisphere-nodejs/fetch.js:30:18) {
code: 'ERR_REQUIRE_ESM'
```

any hint ?

(node v16.13.0
npm 8.1.0)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。