Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Unexpected token #1172

Closed
Berezhnyk opened this issue Mar 27, 2023 · 10 comments · Fixed by #1174
Closed

Module parse failed: Unexpected token #1172

Berezhnyk opened this issue Mar 27, 2023 · 10 comments · Fixed by #1174

Comments

@Berezhnyk
Copy link

Describe the bug

It works fine in the 2.0.0-alpha.41, but the recent 2.0.1 introduced the following error during the build

 ERROR  Failed to compile with 1 error                                  20:25:31

 error  in ./node_modules/@vuelidate/core/dist/index.mjs

Module parse failed: Unexpected token (752:28)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         resultsCache,
|         globalConfig,
>         instance: instance ?? {},
|         externalResults: $externalResults
|       });

 @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/App.vue?vue&type=script&lang=js 2:0-43 17:15-27
 @ ./src/App.vue?vue&type=script&lang=js
 @ ./src/App.vue
 @ ./src/main.js
 @ multi ./src/main.js

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vuelidate-2-composition-api-vue-3@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vuelidate-2-composition-api-vue-3@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Reproduction URL
used original sample with just updated version of the library
https://codesandbox.io/s/competent-phoebe-sxjyjz?file=/package.json

To Reproduce
Steps to reproduce the behavior:

  1. use 2.0.1 version of the package
  2. run npm install
  3. run npm run build
  4. See error

Expected behavior
No error

Additional context
Node version:
v14.20.1

@dobromir-hristov
Copy link
Contributor

Looks like the mjs is not getting transpiled for node 14. I need to check the babel config.

As a workaround you could add the vuelidate core to your babel pipeline or wait a bit. Or try updating to a newer node hehe

@ailsamm
Copy link

ailsamm commented Mar 27, 2023

I'm having the same problem too, as of today. I'm running Node version 18.4.0.

@roquegomez
Copy link

roquegomez commented Mar 29, 2023

Same problem in node 16

@dobromir-hristov
Copy link
Contributor

I will fix it today, sorry all

@Kolobok12309
Copy link

Same problem, fixed by transpiling with babel and @babel/plugin-proposal-nullish-coalescing-operator

@ailsamm
Copy link

ailsamm commented Mar 29, 2023

I will fix it today, sorry all

Thank you, @dobromir-hristov ! Out of curiosity, do you know what caused this? I'm running version 2.0.0 (and have had this for the last few months). I haven't changed my Node version or anything environmental on my end. This just seemed to break out of nowhere when I re-installed my dependencies on Monday. I'd appreciate any insight.

@dobromir-hristov
Copy link
Contributor

I changed the build process and that apparently broke the babel config that was by default.

@ailsamm
Copy link

ailsamm commented Mar 29, 2023

I changed the build process and that apparently broke the babel config that was by default.

Thank you for the clarification!

@dobromir-hristov
Copy link
Contributor

Alright give 2.0.2 a try :)

@ailsamm
Copy link

ailsamm commented Mar 29, 2023

Alright give 2.0.2 a try :)

Confirming that 2.0.2 works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants