Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

SyntaxError: Cannot use import statement outside a module node js

// Note: "import" should generally be used for modules/package projects, otherwise use
// "require"
// In your NodeJS project's package.json add the following "type" field to allow use of "import":
{
  "type": "module"
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Cannot #import #statement #module #node #js
ADD COMMENT
Topic
Name
2+8 =