node.js 에서 ES6 문법 적용하기 [3]


node.js 에서 ES6 문법 적용하기 [3]

SyntaxError: Cannot use import statement outside a module SyntaxError: Unexpected token 'export' SyntaxError:Unexpected reserved word 'static'. 파일이 CommonJS 모듈입니다. ES 모듈로 변환될 수 있습니다.ts(80001) 정말 해결이 될 줄 알았다... 에러 배경 1. express cli 로 node.js 프로젝트를 생성했다. ( $ npm install express-generator ) 2. commonJS 문법 대신 ES6 문법을 사용했다. ( ex. require -> import ) 3. babel 을 설치하고 .babelrc 파일을 생성했다. 4. 실행 스크립트에 babel-node 를 추가했다. 5. nodemon을 설치 6. @babel/node 전역 설치 7. app.js 파일에서 'ES 모듈로 변환&#x2..........



원문링크 : node.js 에서 ES6 문법 적용하기 [3]