JavaScript | nuxt 에서 vee-validator3 사용시 "Unexpected Token: export" 에러날때
페이지 정보
- 작성자:
- 핵탐
- 작성일
- 02.18 12:18
- 조회
- 1,175
- 댓글
- 0
본문
nuxt 는 트랜스파일(비슷한 수준의 다른언어로 변환하는 것)할때 node_modules 는 무시한다.
그래서 /vee-validate/dist/rules 를 build 섹션에 포함해줘야 한다.
nuxt.config.js 의 build 섹션에 아래를 추가하면 된다.
[code]
build: {
transpile: ['vee-validate/dist/rules'],
}
[/code]
공식문서에는 아래와 같이 안내되어 있다.
By default Nuxt ignores transpilation of the node_modules folder,
and since the rules.js is an ES6 export.
You should add vee-validate/dist/rules to the list of sources that will be transpiled.
Otherwise you might run into "Unexpected Token: export" errors.
https://vee-validate.logaretm.com/v3/guide/rules.html#importing-rules-in-nuxt-js
댓글 0개
등록된 댓글이 없습니다.