Closed Flydiverny closed 4 years ago
@wessberg? Thoughts?
I am feeling like we should maybe revert back to rollup-plugin-typescript2
@babel/plugin-transform-runtime is listed as a dependency here. rollup-plugin-ts
has a deep babel integration, just like tsdx
, so version conflicts between babel dependencies of the two packages may arise. In fact, all of the babel dependencies of tsdx
are dependencies of rollup-plugin-ts
and are applied in conjunction with the users babel config when babel is being used as the transpiler (as it is here, per your configuration).
@jaredpalmer, yeah, I understand why you feel that way. rollup-plugin-typescript2
is definitely much narrower scoped (no babel integration, no declaration bundling, etc), it's more of a simple wrapper around the TypeScript compiler API, which you may prefer for tsdx
. The declaration bundling part of rollup-plugin-ts
still have a few issues left to iron out, but we're getting there.
@jaredpalmer - This issue also occurs for @babel/preset-env
.
Error: Cannot find module '@babel/preset-env' from 'C:\Users\Josh\Projects\rush-example\libraries\my-controls'
Seems that these dependencies are being correctly installed, however as @wessberg mentions, there may be a conflict happening here when the module is being resolved. I'm using PNPM which might be a better tool for testing dependencies are installed reliably.
@wessberg -- what would you suggest we do, here? Curious if you see a path forward.
I think I can speak for folks and say, 'don't hold any punches,' right?
@medelman17, well, I guess that comes down to whether or not you will proceed with rollup-plugin-ts
or not. If you are, then the two packages may have conflicting babel dependencies from time to time. One solution could be to make rollup-plugin-ts
fully responsible for all things related to Babel.
@wessberg -- Could you walk us through that? Pros / cons from your perspective?
@medelman17 I've written a lot of details in the README, particularly the FAQ, that you may find relevant here.
But basically, as far as I can tell from the source code, you're running Babel twice. Tsdx uses babel through rollup-plugin-ts since you give it the transpiler: "babel"
option and through babelPluginTsdx
, another Rollup plugin.
I don't know if that plugin is doing anything special, but if not, you might as well leave it out, given that rollup-plugin-ts
is very batteries-included when it comes to Babel.
Now, you may be doing something special with that plugin that I don't know, so it may not be as simple as that. I'm not intimate with the codebase of tsdx
🙂.
But in any case, there's a lot of overlap in the value proposition of tsdx
and rollup-plugin-ts
in relation to juggling the relationship between Babel, Browserslists, and Typescript, which will lead to dependency errors at some point as long as both packages need to sync their Babel dependencies. Moving all babel-related dependencies to peerDependencies
might be an option, but I'm hesitant to do that since that's a lot of packages to ask the user to npm install (or whatever package manager you use, yarn, PNPM, what-have-you)
we've rolled back the plugin change - open new issues for anything v0.11 and up
Current Behavior
Expected behavior
Build working like in 0.9.3 😄
Suggested solution(s)
Additional context
Build works fine in 0.9.3 but upgrading tsdx to latest breaks, doing yarn add
@babel/plugin-transform-runtime
leads to the same error with another babel plugin (@babel/plugin-syntax-dynamic-import
)Guessing this issue is related: https://github.com/wessberg/rollup-plugin-ts/issues/37
Your environment