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.

Feature request: Skip babel transpilation

See original GitHub issue

Tell us how you think we can improve Sandpack

To give some context, I have additional library files in a public folder that is meant to be statically served. Currently, I am passing it to the Sandpack component via the files prop. However, these files have already been transpiled and passing them through the files prop seems to make the babel transpiler do it again. You would think that running it through would not have much impact but it turns out it just generates errors.

Packages affected

  • sandpack-client
  • sandpack-react

What is this feature?

I am proposing that a flag be added to the SandpackFile type to skip babel transpilation.

How would your idea work?

<Sandpack
  files={{
    '/public/jquery.min.js': {
      code: '/public/jquery.min.js',
      transpile: false,  // Default: true
    }
  }}
/>

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:11
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
DeMoorJaspercommented, Nov 11, 2021

@danilowoz this is definitely doable and not a whole lot of work, was gonna work on related tasks anyway in a couple weeks. However this code would still be passed through our custom transformer that collects dependencies and rewrites import statements which uses acorn and it super-fast.

Or should it be more of an isolated module that can never have any dependencies?

Sounds very similar to #119 which we already support in the bundler

1reaction
amareshsmcommented, Aug 24, 2022

@danilowoz Is this issue still open?

Read more comments on GitHub >

github_iconTop Results From Across the Web

grunt: skip babel transpile for core-js #1466 - GitHub
Summary Previously grunt build would transpile the output of browserify to transpile all dependencies, but this would make some dependencies, ...
Read more >
Why you don't need Babel - LogRocket Blog
A common solution is to write using the latest features and transpile down to older-style code the browser will understand.
Read more >
babel/register - Babel.js
One of the ways you can use Babel is through the require hook. The require hook will bind itself to node's require and...
Read more >
Advanced Features: Customizing Babel Config - Next.js
But if you want to extend the default Babel configs, it's also possible. To start, you only need to define a .babelrc file...
Read more >
next-transpile-modules - npm
All features of next-transpile-modules are now natively built-in Next.js ... Transpile modules from node_modules using the Next.js Babel ...
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