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

build: vite v6 #541

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

build: vite v6 #541

wants to merge 9 commits into from

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Dec 9, 2024

Motivation

Svelte v5 and notably @sveltejs/vite-plugin-svelte uses Vite v6 in their last version. Therefore we also want to keep the pace and use those version.

> If bundling, conditions should include development or production. If not bundling, conditions or NODE_ENV should include development or production. See https://www.npmjs.com/package/esm-env for tips on setting conditions in popular bundlers and runtimes.
peterpeterparker added a commit that referenced this pull request Dec 9, 2024
# Motivation

Fix an error - that blocks the build - detected when migrating to Svelte
v5 in #541:

> error during build:
[vite-plugin-svelte] [plugin vite-plugin-svelte]
src/routes/(page)/browser/+page.svelte (27:2):
src/routes/(page)/browser/+page.svelte:27:2 `<tr>` cannot be a child of
`<table>`. `<table>` only allows these children: `<caption>`,
`<colgroup>`, `<tbody>`, `<thead>`, `<tfoot>`, `<style>`, `<script>`,
`<template>`. The browser will 'repair' the HTML (by moving, removing,
or inserting elements) which breaks Svelte's assumptions about the
structure of your components

# Changes

- Add `tbody`
peterpeterparker added a commit that referenced this pull request Dec 9, 2024
# Motivation

Fix a linter error reported by latest Svelte v5 linter in
#541:

> Self-closing HTML tags for non-void elements are ambiguous — use `<div
...></div>` rather than `<div ... />`(element_invalid_self_closing_tag)
svelte/valid-compile

# Changes

- Replace self closing tags. e.g. `<div />` -> `<div></div>`
peterpeterparker added a commit that referenced this pull request Dec 9, 2024
# Motivation

Fix an error - that blocks the build - detected when migrating to Svelte
v5 in #541:

> error during build:
[vite-plugin-svelte] [plugin vite-plugin-svelte]
src/lib/components/MenuItem.svelte (73:10):
src/lib/components/MenuItem.svelte:73:10 Nesting selectors can only be
used inside a rule or as the first selector inside a lone `:global(...)`

It seems that the rule is actually unused / not applied. Therefore I
remove it.

# Changes

- Remove nested CSS global rule.
@peterpeterparker
Copy link
Member Author

peterpeterparker commented Dec 9, 2024

We have an issue upgrading vitest and testing-library to support v5. It seems that having style tag within the components is not support. I reported it there testing-library/svelte-testing-library#284 (comment)

Also made a sample repo to reproduce the issue https://github.com/peterpeterparker/svelte-vite-testing-library-css

@peterpeterparker
Copy link
Member Author

Let's use this PR to migrate to vite v6. Currently blocked because of an incompatibility in Vitest v3.

See sveltejs/vite-plugin-svelte#1043 (comment)

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.

1 participant