-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netlify adapter builds cjs by default #5177
Labels
Milestone
Comments
We're blocked by netlify/zip-it-and-ship-it#749 |
This may be fixed now @ghostdevv with pr #6666 Other possibly relevant issue with zip-it-and-ship-it: netlify/zip-it-and-ship-it#750 |
yeah, this should be fixed. let me know if that's wrong and we can reopen |
awesome!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Currently the netlify adapter builds cjs by default, this is configurable with
functions.node_bundler
in the netlify.toml. The code for that is below:https://github.com/sveltejs/kit/blob/master/packages/adapter-netlify/index.js#L72
What I am trying to understand is why, and if it's still required to be this way. It's causing issues for esm only packages (for example any package made with svelte-kit package) because the cjs bundle that uses
require
is of course unable to import esm.The
esm
variable there is used in the netlify adapter, if it's false then esbuild is used to transpile the generated esm by sveltekit into cjs. I am unsure why it needs to be set to esbuild in thenetlify.toml
because it's a sveltekit adapter doing the transpiling.What I don't fully understand is where
zip-it-and-ship-it
comes in or why we are transpiling at all. I also don't understand what parts of netlify do and don't support esm. Hopefully the netlify guys or anyone here will know! I asked @brittneypostma and she is going to get some help from some of the netlify team if possibleReproduction
I created this repo to show what I mean. It uses a package I made that is esm only. If you remove the netlify.toml OR set the
node_bundler
tozisi
then it will generate CJS and when you visit the site on netlify it breakshttps://github.com/ghostdevv/netlify-sveltekit-esm-only-broke
System Info
Severity
serious, but I can work around it
The text was updated successfully, but these errors were encountered: