-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
bundle with rollup instead of esbuild #6896
Conversation
🦋 Changeset detectedLatest commit: ed5cc7b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sounds like a better plan to me than #6855. it will be slower but will remove lots of headaches
import { rollup } from 'rollup'; | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the JSON plugin? will people be importing JSON that hasn't already been bundled by Vite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They could be using a devdependency that includes JSON which isn't bundled yet but which we want to bundle when adapting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, this needs to work with require('./stuff.json')
@@ -45,6 +45,7 @@ | |||
"uvu": "^0.5.3" | |||
}, | |||
"dependencies": { | |||
"esbuild": "^0.15.7" | |||
"@rollup/plugin-commonjs": "^22.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want these two as dependencies
and @rollup/plugin-json
in devDependencies
? I'd expect them to be in the same place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
the only other thought I had is whether it might be better to use vite rather than rollup to do the bundling. vite will already be in the user's dependencies, but the rollup plugins will not be, so it could reduce the dependency footprint
True. I feel like it adds some more moving parts though, since Vite does a lot of stuff on top of what you get with Rollup. With Rollup everything is very straightforward and predictable |
Alternative to #6855, which is itself an alternative to #6797.
With this PR, we bundle
adapter-node
apps with Rollup instead of esbuild. It's slower, but avoids evanw/esbuild#1921 which doesn't look like it'll be fixed any time soon (even though there's a PR — evanw/esbuild#2067), and means that we can deal with both ESM and CJS dependencies without adding more configuration.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0