자바스크립트 JavaScript
[에러 해결] SyntaxError: Cannot use import statement outside a module
leexx
2024. 1. 6. 02:00
(node:53507) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
프로젝트가 ES Module 을 사용중일 때 import 구문을 사용한 경우 발생하는 에러,
Warning 에 써있는대로 package.json 에 type:module 을 추가해주면 된다.