-
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
failed to transpile
tslib.es6.js
after update to v0.30.0
#264
Comments
You can reproduce it in this repo branch (it uses Rollpkg v0.5.0): https://github.com/rafgraph/react-router-hash-link/tree/rollpkg-0.5.0, just run |
I get this error when trying to do npm run build on that branch:
Is this before rollup-plugin-typescript2 error? I just updated node to latest to get there, otherwise it was erroring out on new JS syntax somewhere much earlier. |
Thanks for looking into this issue. The error is before this. I just created a fresh clone and install and got the error. Weird that you're not getting the error too. Just to make to sure, you're on the branch
|
Yeah
I'm on windows if that makes a difference. |
That could be it. I'm on a Mac v11.2.3. I upgraded to node 14.16 and set verbosity to 3. Here's the log: plugin output with verbosity 3:
|
Surprising that there are no other errors, just |
Failed to transpile
tslib.es6.js
Failed to transpile
tslib.es6.js
Failed to transpile
tslib.es6.js
after update to v0.30.0
So, I took a look at this issue and this was a doozy to figure out, but eventually got to the root cause initial investigation
This took a decent bit more time & effort to investigate as this is not a minimal reproduction -- in general, a minimal repro makes it significantly easier to investigate any issue. Given that most maintainers are volunteers with severely limited time, making it as easy possible for them to investigate should be the goal. It so happens that I solo-maintained TSDX for ~1.5 years (that's how I originally became a contributor here), so reading through Sidebar: TSDX comparison flaws(Also your TSDX comparison is flawed, as TSDX actually uses both TypeScript (via rpt2) and Babel (basically: ts -> esnext -> preset-env), and, again, that's how I found myself here. Otherwise, the comparison is more or less accurate. See jaredpalmer/tsdx#634 and jaredpalmer/tsdx#635 as the two main RFCs I was pushing to get out of the configuration and compatibility hell. Anyway, there were two things that stood out to me initially:
You can probably see where I'm going from here, but therein lies the problem. root cause analysis
Notably, what's missing is a changed (Your So, with that, the problem becomes a lot more straightforward. import { __rest } from "tslib";
import React from "react";
import PropTypes from "prop-types";
import { Link, NavLink } from "react-router-dom"; Note, of course, the presence of So when rpt2 gives this ESM code to Rollup, it parses it and tries to resolve, and if configured to do so, transform, all the imports. So the solution therein is to add what about the lacking error though?
I dug a bit more to really understand this though, in particular as the lack of syntactic or semantic errors is still pretty strange. This is where things start to get complicated... especially as we get into the lacking TS Compiler docs 😕 The Normally, this is caused either by a compiler option error (i.e. I did some logging and that did not make things any less confusing, unfortunately...
rpt2: transpiling '/rpt2-issue-264/node_modules/tslib/tslib.es6.js'
{
outputFiles: [],
emitSkipped: true,
diagnostics: [],
exportedModulesFromDeclarationEmit: undefined
} no semantic or syntactic errors (which is to be expected, given that this is compiled []
[] snapshot exists and is correct (matches the exact source code of StringScriptSnapshot {
text: '/*! *****************************************************************************\r\n' +
'Copyright (c) Microsoft Corporation.\r\n' +
'....'
} So that's odd. I've never seen figuring out
|
Failed to transpile
tslib.es6.js
after update to v0.30.0
failed to transpile
tslib.es6.js
after update to v0.30.0
What happens and why it is wrong
failed to transpile '[...]/node_modules/tslib/tslib.es6.js'
rollup-plugin-typescript2
v0.29.0 works fine, v0.30.0 introduces this error.The setup is a bit complex because it happened as part of Rollpkg. It happens when tsconfig
target: es5
(sotslib
is needed). I was alerted to it from this issue. Rollpkgv0.5.0
has the bug,v0.5.1
fixes it by downgradingrollup-plugin-typescript2
to v0.29.0.I'm using TypeScript
v4.2.3
.The text was updated successfully, but these errors were encountered: