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

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
20 подписчиков
12+
23 просмотра
2 года назад
27 ноября 2023 г.
12+
23 просмотра
2 года назад
27 ноября 2023 г.

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.

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