I am trying to import a node module into my Vue project and am getting the following error:
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
I understand that this is probably due to the node module not being transformed by babelify but I am not sure how to fix it.
My code can be found here:
https://github.com/timothyylim/vue-date-picker-example
Running
npm install
npm run dev
should show the error. I simply started with the vue-cli browserify template and tried to pull in a date picker component.
Any help would be greatly appreciated!
Follow the readme of the project you linked and usevue-cli
: ~Follow up the command-line instructions, I had to install also
@vue/cli-init
as suggested. By the time being this worked, I can see the vue-cli compiles the same example you pointed out.EDIT:
Looks like this was a issue with the component weifeiyue/vue-datepicker-local, it was recently fixed here:
https://github.com/weifeiyue/vue-datepicker-local/commit/a6e3078936a37acc1d6344b7b4d8c14b42be0844
The solution should be as simple as update the component.