-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
svelte:component doesn't work on build mode #6980
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
Comments
Change https://review.dev.storj.io/c/storj/storj/+/6435 mentions this issue. |
The above comment is autogenerated by a bot because I've sent a commit, which mentions this issue, with a workaround until this bug (in case that it's) is fixed. |
Can you make a reduced reproduction showing when it breaks? This doesn't sound like an issue with Svelte but more of an error in your application |
|
There is no error message because https://svelte.dev/docs#svelte_component
|
👍 As @Prinzhorn indicated, you will either need to rely on something other than the constructor name, or make sure that when you minify things, you tell Terser not to mangle names. |
that's the point that I needed for understanding why it worked in Thanks, @Conduitry, and the rest, and my apologies for the noise. |
Change https://review.dev.storj.io/c/storj/storj/+/6439 mentions this issue. |
I introduced a change in the UI that was a better way to dynamically render Svelte components (https://review.dev.storj.io/c/storj/storj/+/5931/4..5) during the review of the first version of it, however, while it works perfectly on development mode it doesn't work when the assets are built for production, failing silently, because the constructor name get renamed due to the name mangling caused by the minifyer as stated in the following issue: sveltejs/svelte#6980 This commit use a different alternative not based on the constructor name and it works fine with the production build. Change-Id: I643c405f877a9206cf0e51b44d5138e5a9756a79
Describe the bug
We have a small frontend that used
svelte:component
directive to render some components dynamically.In development mode (i.e.
npm run dev
) the frontend worked perfectly, however, when it's compiled for production (i.enpm run build
) it doesn't work.The frontend doesn't report any error but it doesn't render the dynamic component; it is like if the
svelte:component
isn't there.Reproduction
Repository with the specific tag version and the directory where the frontend is that allows reproducing the bug: https://github.com/storj/storj/tree/v1.44.1/satellite/admin/ui
In order to reproduce, you can clone the repository, checkout the commit, and go to the
satellite/admin/ui
directory.First, try with
npm run dev
and then withnpm run build
and serve the assets with a simple HTTP server (e.g. https://github.com/projectdiscovery/simplehttpserver).user
)get
)While you will see that 5 it's what happens when running in
dev
mode, it doesn't happen when serving thebuild
assets, only the text will be there but no input element will be rendered.The component that uses the
svelte:component
directive issrc/UIGenerator.svelte
, line 56Logs
System Info
The linked repo in that commit contains everything.
Severity
annoyance
The text was updated successfully, but these errors were encountered: