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

Uncaught SyntaxError: Unexpected token import #20

Closed
ckpinguin opened this issue Apr 20, 2017 · 4 comments
Closed

Uncaught SyntaxError: Unexpected token import #20

ckpinguin opened this issue Apr 20, 2017 · 4 comments

Comments

@ckpinguin
Copy link

ckpinguin commented Apr 20, 2017

As in the docs, I use import { Input } from 'valuelink/lib/tags'
It's transpiling fine, but in the browser code I get:

Uncaught SyntaxError: Unexpected token import
BTW in your README.md it's still import { Input } from 'valuelink/tags.jsx', but that file does not exist anymore in the NPM?

@gaperton
Copy link

but in the browser code I get

Which kind of the browser? Is it IE?

but that file does not exist anymore in the NPM?

I thought I removed it from the docs. Will keep it in NPM for the backward compatibility, though. It's the bug.

@gaperton gaperton reopened this Apr 20, 2017
@gaperton
Copy link

Uncaught SyntaxError: Unexpected token import

Ah, I think I understand what is happening. That's probably because of the fact that tags.tsx is being compiled with ES6 modules imports. So, it can work with webpack 2, but not with webpack 1.

Let me see what I can do, it's tricky.

gaperton pushed a commit that referenced this issue Apr 20, 2017
@gaperton
Copy link

gaperton commented Apr 20, 2017

Okay, published the fix. Now, valuelink/tags is the CommonJS version of tags. Do npm update and try this import line, it should work.

import { Input } from 'valuelink/tags'

Reopen if there are still any problems.

@ckpinguin
Copy link
Author

I'm using create-react-app and a chrome browser, so webpack2 and browser compatibility should be no issue.
I just updated to 1.4.3 (clean new install) and change the import line and it works now. Thanks a ton :-)

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