adapter-node bundling the dependencies of externalized dependencies
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
I have a sveltekit app that requires a package in a monorepo, my-mono-repo-package. That package specifies a bunch of it's own node dependencies. I'm bundling with adapter-node and placed my-mono-repo-package in package.json['dependencies'] to ensure that rollup externalizes the package...
// package.json in sveltekit app
{
"name": "my-website",
"private": true,
"type": "module",
"dependencies": {
"my-mono-repo-package": "file:../package",
}
}
While node-adapter externalizes my-mono-repo-package, it still bundles the dependencies of my-mono-repo-package.
Describe the proposed solution
I figure rollup does this because my-mono-repo-package isn't in node_modules and I haven't explicitly externalized all the dependencies of my-mono-repo-package. It would be awesome if node-adapter/(rollup?) could automatically externalize dependencies of monorepo packages. But perhaps we can expose an option to pass custom externals to adapter-node?
Alternatives considered
At the moment, I'm working around this bug by listing all dependencies of my-mono-repo-package in the the package.json of my-website.
// package.json in sveltekit app
{
"name": "my-website",
"private": true,
"type": "module",
"dependencies": {
"my-mono-repo-package": "file:../package",
"my-mono-repo-package-depedency-1": "*",
"my-mono-repo-package-depedency-2": "*"
}
}
It's a little funky and very verbose, but it unblocks me for now.
Importance
would make my life easier
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/adapter-node/index.js at the linked externalization logic, then inspect how Rollup handles dependencies of the file-linked package described in package.json. Done means the package's dependencies are handled without listing each one in the application package.json, either through automatic externalization or a supported custom-external option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, rollup
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100