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.

TranspiledModule error: module hasn't been transpiled yet

See original GitHub issue

Issue Description

Bug report

Packages affected

  • [✔] sandpack-client
  • [✔] sandpack-react


A /some/module/path: hasn't been transpiled yet. error gets displayed in SandpackPreview’s ErrorOverlay under certain conditions.

🚨 Severity

This seems to prevent Sandpack from working correctly in Safari.

I’d love to get some guidance on how to arrange the files, import statements, or how to halt the execution of the bundled modules until everything is transpiled.

Screen Shot 2022-05-24 at 2 01 50 PM

What were you doing when the problem occurred?

I added a large number of files, and a few library dependencies, and then imported them inside the files. After working in Firefox 100 and Chrome 100 for a while, I noticed the error in macOS Safari 15.4 and iOS Safari 15.4.1.

What steps can we take to reproduce the problem?

Quick reproduction

  • Open this page in Safari:
  • Click the Reload button a few times in the second Sandpack.
  • You may need to click the reload button several times, sometimes it takes 10 reloads before the error is thrown.
  • You should see an error that says /subfolder/cranberry.js: hasn't been transpiled yet..

Additional observations

  • In the example, changing the path of a bundled file from a nested path subfolder/cranberry.js to a root path /cranberry.js makes a difference.
  • In the example, removing an import statement for a library like xstate also removes the error.
  • But when I bundle more files in my real project, having all files’ paths set up at the root level no longer helps, and the error is displayed again.
  • This error is thrown in the TranspiledModule.evaluate method in sandpack-core. It has this comment: This scenario only happens when we are in an inconsistent state, the quickest way to solve this state is to just hard reload everything..
  • When the reproduction repo is run in CodeSandbox in Safari, the error doesn’t seem to be thrown as much upon reloading.

Reproduction repo: link

Live demo: link

Link to sandbox: link

Your Environment

Software Name/Version
Sandpack-client version
Sandpack-react version ^0.19.9
Browser Safari 15.4
Operating System macOS Monterey 12.3

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

DeMoorJaspercommented, May 30, 2022

Yes the v2 bundler has it’s own repository where you can post all the issues you encounter

ryanblisscommented, Jul 15, 2022

This seems questionably related, but I have a dependency that doesn’t work with Webpack5 without Webpack polyfills. As far as I can tell, there is no exposed access to webpack. With the v1 bundler there is a separate issue with this dependency regarding circular dependency errors as such Class extends value undefined is not a constructor or null (3:0), which I haven’t seen using this dependency outside of Sandpack.

This may be a separate issue, so happy to repost with more details and repro, but this thread helped me get this far. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Babel/JSX Transpiler error on build when importing a module ...
You're correct, the issue is that the react-collision-provider hasn't been properly transpiled to be understood by the browser.
Read more >
How to transpile ES modules with webpack and Node.js
Learn how webpack interacts with and supports ES modules in this deep dive tutorial on transpilation in Node.js.
Read more >
Transpiling Typescript into double packages (CommonJS + ...
This happens because you are trying to connect an ES module from the CommonJS module. Alas, in recent years, the number of such...
Read more >
Content Types - ESBuild
Newer syntax may not be supported by older browsers, however, ... But such code will not work with real ECMAScript module implementations such...
Read more >
The JavaScript Modules Limbo - Andrea Giammarchi - Medium
would fail to load a real ESM module that hasn't been transpiled. ... to standard JavaScript as meant by specifications, the result will...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found