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

refactor: use vitefu to handle svelte libraries #478

Merged
merged 18 commits into from
Nov 11, 2022
Merged

refactor: use vitefu to handle svelte libraries #478

merged 18 commits into from
Nov 11, 2022

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 26, 2022

I may have butchered a few debug logs but I'm not sure if there were helpful recently 😬 Tried to preserve most of the code structure as before so it's easier to review.

@dominikg
Copy link
Member

Is vitefu using the exact same createRequire approach to resolve package.json paths? if not this could be a breaking change if it ends up resolving something differently.

@bluwy
Copy link
Member Author

bluwy commented Oct 31, 2022

Currently the only difference is that vitefu uses import-meta-resolve rather than createRequire to resolve ESM-only packages. Problem: doesn't work with yarn pnp - svitejs/vitefu#2

Other than that, I don't think there's anything else different. The naming conventions such as component-library and js-library are now framework-pkg and semi-framework-pkg to keep it agnostic.

@dominikg
Copy link
Member

i'll try to add a testcase, afterwards its good to go

Copy link
Member

@dominikg dominikg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added testcase is still failing in dev for a cjs dependency that is not optimized and during build cjs ends up in the output. build passes but browser fails.

const svelteImportsToInclude = SVELTE_IMPORTS.filter((x) => x !== 'svelte/ssr'); // not used on clientside
log.debug(
`adding bare svelte packages to optimizeDeps.include: ${svelteImportsToInclude.join(', ')} `
);
include.push(...svelteImportsToInclude.filter((x) => !isIncluded(x)));
include.push(...svelteImportsToInclude);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I removed this filter as it's fine to include duplicate identifiers

@bluwy bluwy merged commit 50db140 into main Nov 11, 2022
@bluwy bluwy deleted the use-vitefu branch November 11, 2022 16:50
@github-actions github-actions bot mentioned this pull request Nov 11, 2022
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

Successfully merging this pull request may close these issues.

2 participants