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

Use src attribute on i18n component with vue-cli not working #401

Closed
deather opened this issue Jul 27, 2018 · 0 comments
Closed

Use src attribute on i18n component with vue-cli not working #401

deather opened this issue Jul 27, 2018 · 0 comments

Comments

@deather
Copy link

deather commented Jul 27, 2018

vue & vue-i18n version

vue : 2.5.16
vue-18n : 8.0.0
vue-i18n-loader : 0.3.0

Reproduction Link

https://github.com/deather/vue-i18n-loader-bug

Steps to reproduce

You just need to execute : npm run serve

What is Expected?

No compilation error.

What is actually happening?

When I execute the command a compilation error occured :

error  in ./src/i18n/helloWorld.json?vue&type=custom&index=0&blockType=i18n&issuerPath=%2Fhome%2Fcharles.jourdan%2FWorkspace%2Fperso%2Fpouet%2Fsrc%2Fcomponents%2FHelloWorld.vue

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 (/home/charles.jourdan/Workspace/perso/pouet/node_modules/json-parse-better-errors/index.js:7:17)
    at JsonParser.parse (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/JsonParser.js:16:16)
    at doBuild.err (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/NormalModule.js:445:32)
    at runLoaders (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/NormalModule.js:327:12)
    at /home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:370:3
    at iterateNormalLoaders (/home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
    at /home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:183:6
    at runSyncOrAsync (/home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at /home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:175:3
    at loadLoader (/home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/charles.jourdan/Workspace/perso/pouet/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/NormalModule.js:265:3)
    at NormalModule.build (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/NormalModule.js:412:15)
    at Compilation.buildModule (/home/charles.jourdan/Workspace/perso/pouet/node_modules/webpack/lib/Compilation.js:616:10)

 @ ./src/components/HelloWorld.vue 21:0-184 22:11-17 22:34-40
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
 @ ./src/App.vue?vue&type=script&lang=js&
 @ ./src/App.vue
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.0.11:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

When I don't use src, it's working like a charm. I think when you put src attribute, webpack embed the json file in an import. Maybe it's just a missconfiguration, but I start a new project from scratch and follow the step on different documentation.

Thanks for reading and helping.

@kazupon kazupon added Type: Bug Bug or Bug fixes and removed in confirm labels Jul 31, 2018
@kazupon kazupon added upstream and removed Type: Bug Bug or Bug fixes labels Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants