question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build fails on 0.10.5: Cannot find module @babel/...

See original GitHub issue

Current Behavior

$ tsdx build
Error: Cannot find module '@babel/plugin-transform-runtime' from '/path-to-pkgs/packages/auth'

    at Function.module.exports [as sync] (/path-to-pkgs/packages/auth/node_modules/resolve/lib/sync.js:74:15)
    at resolveStandardizedName (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePlugin (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
    at loadPlugin (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
    at createDescriptor (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at /path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
    at Array.map (<anonymous>)
    at createDescriptors (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPluginDescriptors (/path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
    at /path-to-pkgs/packages/auth/node_modules/@wessberg/rollup-plugin-ts/node_modules/@babel/core/lib/config/config-descriptors.js:63:49

error Command failed with exit code 1.

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

Software Version(s)
TSDX 0.10.5
TypeScript 3.6.4
Browser N/A
npm/Yarn yarn 1.19.1
Node node v12.10.0
Operating System osx

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sw-yxcommented, Nov 4, 2019

we’ve rolled back the plugin change - open new issues for anything v0.11 and up

0reactions
wessbergcommented, Oct 23, 2019

@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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module build failed: Error: Cannot find module '@babel/core'
The problem is that I've installed a newer version of babel, @babel/preset-env which is babel version 7. Version 6 isn't working that way...
Read more >
Upgrade to Babel 7
Assuming your node_modules folder is in . , in Babel 6 this would fail because the preset could not be found. This change...
Read more >
[solved] Some package update completely breaks my app ...
So I did a standard meteor update : iMac:app patrick$ meteor update This project is already at Meteor 1.6.1, the latest release.
Read more >
Babel issue running npm run dev after upgrade to Mix
Babel issue running npm run dev after upgrade to Mix ... Error: Cannot find module 'babel-plugin-transform-object-rest-spread' from '/home/sln/code/cloud' ...
Read more >
@babel/helper-environment-visitor | ...
0.0-beta.52 . This means this will only break your build if you are using ^ in Babel v7 beta (which we have recommended...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found