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 摘要。