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

sourcing js file from static folder breaks on 1.0.0-next.390 #5672

Closed
bhvngt opened this issue Jul 22, 2022 · 10 comments
Closed

sourcing js file from static folder breaks on 1.0.0-next.390 #5672

bhvngt opened this issue Jul 22, 2022 · 10 comments
Labels
bug Something isn't working p0-urgent SvelteKit is broken or vulnerable for most users
Milestone

Comments

@bhvngt
Copy link

bhvngt commented Jul 22, 2022

Describe the bug

After upgrading to the latest sveltekit version (1.0.0-next.390), I am not able to source js file from the static folder. Infact, it breaks for even css files. I believe this is due to #5648. Not sure, if there is any configuration that needs to be changed to make it work.

I am sourcing it by adding following code inside app.html head tag.

<script src="%sveltekit.assets%/sample.js"></script>

Reproduction

Reproduction

Logs

Failed to load url /sample.js (resolved id: /sample.js). This file is in /public and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.
    at loadAndTransform (file:///home/projects/sveltejs-kit-template-default-5jzsnx/node_modules/vite/dist/node/chunks/dep-1513d487.js:39810:19

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.63 
    @sveltejs/kit: 1.0.0-next.390 => 1.0.0-next.390 
    svelte: ^3.46.0 => 3.49.0 
    vite: ^3.0.0 => 3.0.2

Severity

blocking an upgrade

Additional Information

No response

@wickning1
Copy link

I'm getting this same error message with the global.css file after upgrading sveltekit and creating my vite.config.js for the first time. I'm not referencing it anywhere except the app.html.

@homerjam
Copy link

I'm also experiencing this...

<!-- app.html -->
...
<link rel="stylesheet" href="/fonts/fonts.css" />
...

Screenshot 2022-07-22 at 16 54 23

@kuchaguangjie
Copy link

vite 3 use /public for static asset by default, is that relevant? It also break my code, my temp solution is:
hperrin/svelte-material-ui#489 (comment)

@Ncookiez
Copy link
Contributor

Also breaking on my end (css file in static folder).

@hperrin
Copy link

hperrin commented Jul 22, 2022

I can confirm that this also happens when you use <link href="{assets}/somefile.css" /> in a <svelte:head>.

@TerranceLuke
Copy link

Having the exact same issue and it's blocking an upgrade.

@Arstman
Copy link

Arstman commented Jul 23, 2022

same issue happened here, i upload to s3 and use outlink to get rid of this annoying message, hope this can be fixed soon.

@benmccann benmccann added bug Something isn't working p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc. p0-urgent SvelteKit is broken or vulnerable for most users and removed p1-important SvelteKit cannot be used by a large number of people, basic functionality is missing, etc. labels Jul 23, 2022
@benmccann benmccann added this to the 1.0 milestone Jul 23, 2022
@ball6847
Copy link

From my testing, this bug starts happening since 1.0.0-next.387, we need to pin @sveltejs/kit version to 1.0.0-next.386 to keep the project running.

@Rich-Harris
Copy link
Member

Sorry about this everyone. I've undone the bad PR, and this should now be fixed.

@michal-kapala
Copy link

I still have had this issue with 1.0.0-next.391, updating sveltekit to 392 resolved it.

michal-kapala added a commit to 25-To-Life/25tolife-website that referenced this issue Jul 25, 2022
+ @sveltejs/kit version update 391 -> 392 to resolve Vite's issue with SMUI (sveltejs/kit#5672)
+ SMUI with a template DataTable added
+ prisma relations added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p0-urgent SvelteKit is broken or vulnerable for most users
Projects
None yet
Development

No branches or pull requests