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

Json loader failed to import aws-amplify json files #860

Closed
putstrln opened this issue Mar 28, 2018 · 2 comments · Fixed by #861
Closed

Json loader failed to import aws-amplify json files #860

putstrln opened this issue Mar 28, 2018 · 2 comments · Fixed by #861

Comments

@putstrln
Copy link
Contributor

I'm submitting a bug report

  • Library Version:
    0.33.1

Please tell us about your environment:

  • Operating System:
    Ubuntu 16.04

  • Node Version:
    8.10.0

  • NPM Version:
    3.10.4
  • Browser:
    all

  • Language:
    TypeScript 2.7.2

  • Loader/bundler:
    Webpack

Current behavior:
You can create a new cli project and choose typescript and webpack defaults.

Install aws-amplify, yarn add aws-amplify

In main.ts, import Amplify from 'aws-amplify'.

And call Amplify.configure({...}).

Running au run fails with json errors,

ERROR in ./node_modules/aws-sdk/lib/region_config_data.json
Module parse failed: Unexpected token m in JSON at position 0
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token m in JSON at position 0
    at JSON.parse (<anonymous>)
    at JsonParser.parse (node_modules/webpack/lib/JsonParser.js:15:21)
  • What is the expected behavior?
    Following the above steps should compile the app correctly.
  • What is the motivation / use case for changing the behavior?
    aws-amplify should work with aurelia cli.

So I removed the json loader line from webpack.config.js, the app compiled and I could use the amplify library. Webpack docs also say that json-loader isn't required for webpack 2 and above. If this is the correct fix, I can send a PR. Otherwise, pls suggest what I might be missing. Thanks.

@Alexander-Taran
Copy link
Contributor

Alexander-Taran commented Mar 28, 2018

Would you like to provide a pull request for it @lovetostrike to remove json loader from generated webpack.config files for cli?
I can point you in right direction if you need.

@Alexander-Taran
Copy link
Contributor

@JeroenVinke legit PR
1 line removed

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

Successfully merging a pull request may close this issue.

2 participants