question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module parse failed

See original GitHub issue

vue & vue-i18n version

vue : 2.5.16 (I’m using the cli) vue-i18n : 8.0.0

Reproduction Link

https://github.com/RemiVillien/VueI18nError

Steps to reproduce

npm run serve

What is Expected?

No ERROR

What is actually happening?


Module parse failed: Unexpected token i in JSON at position 0 while parsing near 'import mod from "-!....'
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token i in JSON at position 0 while parsing near 'import mod from "-!....'
    at JSON.parse (<anonymous>)
    at parseJson (/usr/src/app/node_modules/json-parse-better-errors/index.js:7:17)
    at JsonParser.parse (/usr/src/app/node_modules/webpack/lib/JsonParser.js:16:16)
    at doBuild.err (/usr/src/app/node_modules/webpack/lib/NormalModule.js:443:32)
    at runLoaders (/usr/src/app/node_modules/webpack/lib/NormalModule.js:325:12)
    at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:370:3
    at iterateNormalLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
    at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:183:6
    at runSyncOrAsync (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at /usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:175:3
    at loadLoader (/usr/src/app/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/usr/src/app/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/usr/src/app/node_modules/webpack/lib/NormalModule.js:263:3)
    at NormalModule.build (/usr/src/app/node_modules/webpack/lib/NormalModule.js:410:15)
    at Compilation.buildModule (/usr/src/app/node_modules/webpack/lib/Compilation.js:616:10)

 @ ./src/App.vue 21:0-126 22:11-17 22:34-40
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://172.17.0.2:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

Hi,

I don’t want to bother but I really don’t understand why I get this error, I only get that when I add <i18n src='./locales/en-US.json'></i18n> to any .vue file. I’m prety sure I did something wrong but I just don’t understand what it is. I hope you can help me 🙏

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
RemiKalbecommented, Jul 25, 2018

Ok I figured it out, I don’t think it’s the right way, but it works

const messages = {
    "en-US": require("./locales/en-US.json"),
    "fr-FR": require("./locales/fr-FR.json")
};

const i18n = new VueI18n({
    locale: navigator.language,
    fallbackLocale: 'en-US',
    messages
});
1reaction
kazuponcommented, Jul 31, 2018

seem same #401 issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module parse failed: Unexpected token - Stack Overflow
Apparently it happened because you have two module properties in the webpack config object. Given JS objects can only hold one value per...
Read more >
Module parse failed: Unexpected token. You may ... - GitHub
This is a library build issue. We moved to ts3.8 without thinking about optional chaining transpiling. Here seems like a correct way to...
Read more >
Odyssey Lift-off I: "Module parse failed: Unexpected token" Error
I am receiving this error message: Failed to compile. ./src/pages/tracks.js 43:10. Module parse failed: Unexpected token (43:10)
Read more >
Module parse failed: Unexpected token (1:0) - Laracasts
Hello , After running npm run watch I see this error : ERROR in ./resources/js/components/irp/admin/EditGroup.vue 1:0 Module parse failed: Unexpected token ...
Read more >
module parse failed: unexpected token (1:0) you may need an ...
Module parse failed: Unexpected token - Stack Overflow ... 1 Answer. Apparently it happened because you have two module properties in the webpack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found