Skip to content
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

outfile is always slicing 1 character #5

Open
smeijer opened this issue Sep 20, 2023 · 0 comments
Open

outfile is always slicing 1 character #5

smeijer opened this issue Sep 20, 2023 · 0 comments

Comments

@smeijer
Copy link

smeijer commented Sep 20, 2023

The bundle is always written to a path where the outfile gets sliced. I think it makes sense to simply replace a leading slash, so we can have outFile: '_worker.js' instead of outFile: '/_worker.js'. Given that the entry point isn't allowed to have a leading slash, and need to be "neither absolute nor relative", it feels more natural to also not have a leading slash for the outFile.

I think it's just the filename here:

context.emitFile({
id: opts.id,
fileName: url.slice(1),
type: "chunk",
});

But I'm unsure about what this id slice does:

return {
id: (await emit(this)).slice(1),
external: true,
};

Patching it in my node_modules to be .replace(/^\//, "") did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant