Using babel-preset-solid in browser
here is my minimal reproduce:
https://github.com/c8se/solid-babel-reproduce/blob/main/src/main.ts
According to solid playground, I added vite config defines:
But it still throwing " _assert is not a function", any idea how to resolve this? Thanks.
GitHub
solid-babel-reproduce/src/main.ts at main · c8se/solid-babel-reprod...
Contribute to c8se/solid-babel-reproduce development by creating an account on GitHub.
4 Replies
I think all you have to do is
pnpm i assert
(as looks like some babel code requires it and tries to resolve it from the package.json
)
So your package.json should look like this
Just spent the last 30 mins digging through the stack trace hahaI also digged into packed babel.js file but not realized that the empty object is the fallback of this missing package, thanks a lot for your time!
i am playing around with transpiling solid in the browser too (https://github.com/bigmistqke/repl) and found the easiest way to import the
babel-preset-solid
plugin straight from esm.sh
cdn. that way the plugin itself and all of its dependencies are esm-friendly.GitHub
GitHub - bigmistqke/repl: 🗒️ Unstyled building blocks to compose ty...
🗒️ Unstyled building blocks to compose typescript playgrounds ⚡ Powered by monaco-editor and solid-js. - bigmistqke/repl
there are some performance benefits to bundling it yourself though
so grain of salt