Open jgentes opened 3 years ago
I got the same issue.
Manually update parcel package under example app to the latest version fix the bug "parcel": "^2.0.0-beta.1"
So this is caused by Parcel, not TSDX. It's caused by the very recent and the only pinned issue from Parcel: https://github.com/parcel-bundler/parcel/issues/5943 . That, in turn, is caused by a recent change in Babel: https://github.com/babel/babel/issues/12945 .
It seems like the Babel folks have deemed this a Parcel bug of using the API the wrong way (even though it only broke now after a few years), and the Parcel folks are currently not maintaining Parcel v1 despite v2 not being ready yet...
There's not really much TSDX can do here because Parcel v2 isn't fully ready (upgrading the example deps to a beta generally means asking for more bug reports) and Babel and Parcel aren't fixing this as of now 😕
You're welcome to workaround by upgrading to the beta yourself at your own risk as @phamhieu suggests and working through any bugs there with the Parcel team. Although, based on the Parcel and Babel threads, v2 also has this bug in it, but doesn't always hit it.
There is also a workaround by pinning @babel/preset-env
to 7.13.8
via resolutions
, as provided by the Babel team in https://github.com/parcel-bundler/parcel/issues/5943#issuecomment-788928442 :
"resolutions": {
"@babel/preset-env": "7.13.8"
}
Also, with regard to the issue template:
Your environment
The comment below this line should stay commented out and, importantly, you're missing the version of TSDX in your output; you probably ran this outside of your project directory -- the directions say to run inside of it.
So there's been a fix pending upstream in https://github.com/parcel-bundler/parcel/pull/5946 for almost as long as the issue has existed, but unfortunately it has not gotten much attention despite the wide impact of this across the JS community
You're welcome to workaround by upgrading to the beta yourself
Sadly, this will break hot module reloading. I couldn't find any solution so I gave up.
Right now, I use parcel v1.12.3
which doesn't have the above issue.
// on example/package.json
// From
"parcel": "^1.12.3",
// To
"parcel": "1.12.3",
Right now, I use parcel
v1.12.3
which doesn't have the above issue.
I'm not sure why folks are saying this; this might be a coincidence of yarn.lock
getting resolved to a lower version of @babel/preset-env
, but v1.12.3
has the same bug and similarly does not pin preset-env
. So I would not recommend that and would recommend the resolution
I listed above and upvoting the upstream issue and PR.
ah thanks for correcting me @phamhieu ! I posted a link to that line too on the same commit (tagged specifically to v1.12.3
) but maybe I was looking at the wrong commit before changing the URL because I didn't see that until now.
Those Babel versions are pretty old, but for the example
app they're probably fine. (would not recommend for a library itself though).
It seems parcel-bundler
1.12.5 has the fix. See https://github.com/parcel-bundler/parcel/issues/5943#issuecomment-799899064
It seems
parcel-bundler
1.12.5 has the fix. See parcel-bundler/parcel#5943 (comment)
I experienced this issue today. I added "parcel-bundler": "1.12.5",
as a devDependency in the example's package.json file. After installing the error was quickly resolved. I'd recommend this approach until a more permanent fix is available from Parcel.
EDIT: Today I was working in a fresh TSDX React Storybook project, and it took some trial and error to get this error fixed. If I npm installed with parcel-bundler already in package.json, the error always persisted. I was able to get it to work by installing packages, running npm start
to confirm it failed, then npm i -D parcel-bunder@1.12.3
. Then an npm start
worked as expected. Other note, I'm using Node 14 with NPM 7.
I tried "parcel-bundler": "1.12.5"
the example can compile and run but hot-reload stops working. Not sure why!!!
I got the same issue.
Manually update parcel package under example app to the latest version fix the bug
"parcel": "^2.0.0-beta.1"
It's ok. Or try yarn add parcel
@nfl404 this works. But every time I make a change in my library I have to delete .parcel-cache in my example folder and npm start (example folder) to see the changes. Any fixes??
I don't think there is a permanent fix to this as of now until babel resolves the error.
encountered the same issue, i just updated the parcel manually to the latest version and it worked.
I ran
npx tsdx create mixpoint
and chose thereact
option, then went into /example and rannpm install
thennpm start
and ran into this:Your environment
PLEASE RUN THIS COMMAND INSIDE YOUR PROJECT:
npx envinfo --system OS --browsers --binaries --npmPackages tsdx,typescript --npmGlobalPackages tsdx,typescript