Добавить
Уведомления

HOW TO FIX SyntaxError: Cannot use import statement outside a module

Are you using imports in a node.js application and running into the SyntaxError: Cannot use import statement outside a module error? Here are 3 ways to fix this error. If you're developing a JavaScript application, then add "type": "module" into your package.json file. If you're developing a TypeScript application, then make sure "module" is set to "commonjs" in your tsconfig.json file. If you're importing a script in a HTML file, then add type="module" into the script tag.

Иконка канала Все о CSS
21 подписчик
12+
25 просмотров
2 года назад
12+
25 просмотров
2 года назад

Are you using imports in a node.js application and running into the SyntaxError: Cannot use import statement outside a module error? Here are 3 ways to fix this error. If you're developing a JavaScript application, then add "type": "module" into your package.json file. If you're developing a TypeScript application, then make sure "module" is set to "commonjs" in your tsconfig.json file. If you're importing a script in a HTML file, then add type="module" into the script tag.

, чтобы оставлять комментарии