-
Notifications
You must be signed in to change notification settings - Fork 71
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
Error: Unexpected token
when importing axios -- node-resolve
should be first
#66
Comments
Could you try suggestion made here: rollup/rollup-plugin-commonjs#28 (using |
Thanks, that seems to work (adding The output is very different from rolling up the corresponding .js file though, with the iife signature becoming var SomeName = (function (exports,tty,util,url,http,https,assert,stream,zlib)... I was expecting rollup-plugin-typescript2 to basically run tsc with my tsconfig.config as a pre-rollup step, but when I do that (tsc first, then rollup without the typescript plugin) I get var SomeName = (function (exports)... I'm probably missing some config setting here..? |
Are those other parameters used inside the function at all? Is the body the same in both cases? |
Yes, they are used, and there's an additional big chunk, starting with function createCommonjsModule(fn, module) { in the middle of the body (when using the typescript plugin compared to using plain js as the source). A lot of it seems related to Node debugging functionality. |
Looking at your test repo, the plugin produces the same output tsc does. You can check for it in The main difference in 2 results is when Webpacked build is apparently the browser version that get magically found by If you put typescript plugin last in the chain, rollup uses This line in your test repo: This is the first time I've seen plugin order actually matter :). I'll update readme. |
You probably don't need json plugin now either. |
@ezolenko I was really thrown off by the readme 😬 It says:
I think I was thinking where do I put the typescript plugin, and then I read the next line and thought Great work though! Thanks |
Fixed, thanks :) |
Unexpected token
when importing axios
Unexpected token
when importing axiosUnexpected token
when importing axios -- node-resolve
should be first
Same error as when importing axios into pure ES6 project and not having set
browser: true
forrollup-plugin-node-resolve
. Simple test case: single js file containingUsing the below rollup.config.js produces the error, but when excluding rollup-plugin-typescript2 it works.
Versions
rollup.config.js
The text was updated successfully, but these errors were encountered: