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

'Unexpected token` when running rollup with axios #76

Closed
NicklasWallgren opened this issue Aug 14, 2017 · 6 comments
Closed

'Unexpected token` when running rollup with axios #76

NicklasWallgren opened this issue Aug 14, 2017 · 6 comments

Comments

@NicklasWallgren
Copy link

NicklasWallgren commented Aug 14, 2017

Im getting the following error when running npm run start with the default rollup.config.js.

Error: Unexpected token
node_modules/axios/package.json (2:9)
1: {
2:   "_from": "axios@^0.16.2",
@alexjoverm
Copy link
Owner

Hi @NicklasWallgren,

Is somehow weird, but axios node adapter requires its own package.json which rollup doesn't understand by default.

To make rollup understand json files, just use rollup-plugin-json. I've just tried and it's working fine.

@maxime1992
Copy link
Contributor

Lost so much time on this one, maybe you should consider to add the plugin by default @alexjoverm ?

It was not working without that for a table module and now with https://github.com/sindresorhus/ora

I've just added

import json from 'rollup-plugin-json'

and json(), within the plugins array and it's fine now.

@alexjoverm
Copy link
Owner

That sounds like a good plan @maxime1992. Would you mind sending a PR? It should be easy :)

@maxime1992
Copy link
Contributor

I'll try to do that this evening :)

maxime1992 added a commit to maxime1992/typescript-library-starter that referenced this issue Mar 15, 2018
@maxime1992
Copy link
Contributor

@alexjoverm done ;)

@SumNeuron
Copy link

@maxime1992

Error: 'default' is not exported by node_modules/axios/index.js

https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-

1: import axios from 'axios'
          ^
2: 
3: const api = axios.create({


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

4 participants