Skip to content

test: add tests for prebundleSvelteLibraries #491

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

Closed
wants to merge 1 commit into from

Conversation

dominikg
Copy link
Member

cherry-picked the tests from #478 on main to compare the results

Comment on lines +35 to +37
expect(optimizedPaths).toContain(
'e2e-test-dep-svelte-nested > e2e-test-dep-svelte-simple > e2e-test-dep-cjs-only'
);
Copy link
Member

Choose a reason for hiding this comment

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

This is failing as we don't do deep optimization when prebundleSvelteLibraries yet.

optimizeDeps: {
// TODO this must be excluded because nested has an scss dep that prebundle can't handle!
// figure out how to exclude it automatically or at least tell the user about it in a more friendly way
exclude: ['e2e-test-dep-svelte-nested'],
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a bug in Vite. Currently it externalizes .scss/.css etc files when prebundling, but looks like it's failing when it's a package that exports a .scss file. Replacing this as e2e-test-dep-scss-only should have the same effect

Comment on lines +12 to +14
// TODO without this, it fails for module.exports in the browser.
// shouldn't prebundling take care of it?
'e2e-test-dep-svelte-hybrid > e2e-test-dep-cjs-only'
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this will be fixed by #482. The requests shows that it's not using the prebundled files.

Copy link
Member

Choose a reason for hiding this comment

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

Here's a snippet of it

import Hybrid from '/@fs/Users/bjorn/Work/oss/vite-plugin-svelte/node_modules/.pnpm/file+packages+e2e-tests+_test_dependencies+svelte-hybrid/node_modules/e2e-test-dep-svelte-hybrid/index.js';
import Simple from '/@fs/Users/bjorn/Work/oss/vite-plugin-svelte/node_modules/.pnpm/file+packages+e2e-tests+_test_dependencies+svelte-simple/node_modules/e2e-test-dep-svelte-simple/index.js';
import { Message as Nested } from '/@fs/Users/bjorn/Work/oss/vite-plugin-svelte/node_modules/.pnpm/file+packages+e2e-tests+_test_dependencies+svelte-nested/node_modules/e2e-test-dep-svelte-nested/src/index.js';
import { setSomeContext } from '/node_modules/.vite/deps/e2e-test-dep-svelte-api-only.js?v=89f48f1a';
import { getContext } from '/node_modules/.vite/deps/svelte.js?v=89f48f1a';
const file = "src/App.svelte";

@bluwy
Copy link
Member

bluwy commented Nov 11, 2022

Tests merged into #482

@bluwy bluwy closed this Nov 11, 2022
@bluwy bluwy deleted the test/prebundle-svelte-without-vitefu branch November 11, 2022 15:53
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