sandpack
sandpack copied to clipboard
Feature request: Skip babel transpilation
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
- [x] 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
}
}}
/>
Hey @S0ulDrag0n thanks for letting us know about this issue. @DeMoorJasper do you think it's something doable? Curious to know how much effort it would require to implement it
@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
Or should it be more of an isolated module that can never have any dependencies?
I think there's a chance that may be the case. Perhaps there should be another flag for skipping that as well?
Yeah probably, for your example you can probably use externalResources
for now, but we've added this feature request to the backlog, there's some bundler refactoring planned that will make this possible so will implement it once that is done.
@danilowoz Is this issue still open?
Yeah, this's a valid issue. However, it's not a priority now. Please thumbs up the main comment for those who are interested in this feature.
+1 for skipping babel transpilation.