Skip to content

dateformat not working with "require" ?Β #176

@thomas-topway-it

Description

@thomas-topway-it

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.<anonymous> (/var/www/html/wikisphere-nodejs/fetch.js:30:18) {
  code: 'ERR_REQUIRE_ESM'

any hint ?

(node v16.13.0
npm 8.1.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions