Skip to content

adapter-node bundling the dependencies of externalized dependencies #10834

@john-michael-murphy

Description

@john-michael-murphy

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions