Skip to content

Latest build breaks svelte completely #15768

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
Zhoros opened this issue Apr 15, 2025 · 1 comment
Closed

Latest build breaks svelte completely #15768

Zhoros opened this issue Apr 15, 2025 · 1 comment

Comments

@Zhoros
Copy link

Zhoros commented Apr 15, 2025

Describe the bug

I have tested with older version of svelte 3.0.x and it worked fine,
The latest version as of today, 5.27.0, is not working, I have observed this issue in previous 5.20.0 as well

I created my project with vite, it seems to be an issue with the compiler itself more than anything.

package.json

{
  "name": "vite-project",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "start": "vite build --watch"
  },
  "devDependencies": {
    "@sveltejs/vite-plugin-svelte": "^5.0.3",
    "svelte": "^5.27.0",
    "vite": "^6.2.0"
  }
}

vite.config.js (This should be irrelavant, but just gonna put it here)

import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'

// https://vitejs.dev/config/
export default defineConfig({

	root: './src',
	base: './',
	server: {
		watch: {
			usePolling: true,
			interval: 250,
		}
	},
	plugins: [svelte()],
	build: {

		rollupOptions: {
			
			input: {
				
				page: './src/page.html',

			},

		},

		outDir: '../../public/authorized/s',
		assetsDir: '',
		emptyOutDir: true,

	}

})

page.svelte

<script>

</script>

<main>

	<span>test</span>
	
</main>

resulting page-B20UA30j.js

(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))o(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function i(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function o(e){if(e.ep)return;e.ep=!0;const r=i(e);fetch(e.href,r)}})();const f="5";var c;typeof window<"u"&&((c=window.__svelte??(window.__svelte={})).v??(c.v=new Set)).add(f);const a=2;var u,d;function l(t){return d.call(t)}let m=null;function p(t){var n=document.createElement("template");return n.innerHTML=t,n.content}function _(t,n){var i=m;i.nodes_start===null&&(i.nodes_start=t,i.nodes_end=n)}function g(t,n){var i=(n&a)!==0,o,e=!t.startsWith("<!>");return()=>{o===void 0&&(o=p(e?t:"<!>"+t),o=l(o));var r=i||u?document.importNode(o,!0):o.cloneNode(!0);return _(r,r),r}}function v(t,n){t!==null&&t.before(n)}var y=g("<main><span>test</span></main>");function h(t){var n=y();v(t,n)}new h({target:document.getElementById("app")});

Image

Image

Reproduction

Logs

above

System Info

on windows 11, using node v22 LTS. Tested on microsoft edge

Severity

can't use at all

@Zhoros
Copy link
Author

Zhoros commented Apr 15, 2025

Svelte 5 uses mount() function, I had to modify my .js file.

@Zhoros Zhoros closed this as completed Apr 15, 2025
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