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

Dependency with jsx doesn't work #1330

Closed
kuba-orlik opened this issue May 9, 2018 · 7 comments
Closed

Dependency with jsx doesn't work #1330

kuba-orlik opened this issue May 9, 2018 · 7 comments
Labels

Comments

@kuba-orlik
Copy link

kuba-orlik commented May 9, 2018

🐛 bug report

since parcel v1.5 requiring an npm-installed dependency with jsx modules doesn't work - Parcel doesn't process the jsx file.

🎛 Configuration (.babelrc, package.json, cli command)

.babelrc:

{
	"presets": ["env", "react"]
}

command:

parcel build src/frontend/index.html --out-dir public --public-url /

🤔 Expected Behavior

The jsx files are transpiled and made a part of the bundle

😯 Current Behavior

An error is thrown:

⏳  Building...
🚨  /opt/project/node_modules/sealious/cosealious/lib/loading.jsx:10:3: Unexpected token (10:3)
   8 | 	for (var i = 0; i < boxes_amnt; i++) {
   9 | 		boxes.push(
> 10 | 			<div

💁 Possible Solution

The only fix I've found is to downgrade parcel to version <1.5, which is obviously undesirable

🔦 Context

We have a library of jsx components that we install via npm.

💻 Code Sample

https://github.com/kuba-orlik/parcel-rep

🌍 Your Environment

Software Version(s)
Parcel 1.8.
Node 9.11.1
npm 5.8.0
Operating System Linux
@newtriks
Copy link

I've the same issue, slightly different circumstances where I have a project configured using Lerna and need to compile imported (local) packages within that architecture.

@mohsen1
Copy link
Contributor

mohsen1 commented May 17, 2018

If you own the dependency you can set the source key in package.json to point to source. When symlinked, Parcel will compile source of those dependencies too.

@kuba-orlik
Copy link
Author

kuba-orlik commented May 18, 2018

@mohsen1

you can set the source key in package.json to point to source

What do you mean?

@DeMoorJasper
Copy link
Member

See #1101

Sent with GitHawk

@newtriks
Copy link

This fixes my original issue thanks.

@mischnic mischnic added the Babel label Mar 5, 2019
@embeddedt
Copy link

When symlinked, Parcel will compile source of those dependencies too.

Is it possible to do this without symlinks? I am trying to use an npm package that uses JSX and I am having the exact same issue as the original poster (syntax error on the first JSX statement).

I did try putting "source": true in the package.json of the JSX module but that didn't change anything.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Oct 12, 2020
@parcel-bundler parcel-bundler deleted a comment from ihorml Oct 12, 2020
@parcel-bundler parcel-bundler deleted a comment from rv-thlittle Oct 12, 2020
@parcel-bundler parcel-bundler deleted a comment from szympajka Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants