question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
Rich-Harriscommented, Jul 23, 2022

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

2reactions
ball6847commented, Jul 23, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Flask, Keep getting 404 serving static files using ...
Finally got it working. use flask.send_from_directory from flask import send_from_directory @app.route('/js/<path:filename>') def serve_static(filename): ...
Read more >
Manage Django Static Files (Images, JS, CSS)
In your Django project directory, create a new folder named static. In the example above, the static folder is in the project folder...
Read more >
sourcing `js` file from static folder breaks on `1.0.0-next.390`
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...
Read more >
Static files — Explore Flask 1.0 documentation
As their name suggests, static files are the files that don't change. In your average app, this includes CSS files, JavaScript files and...
Read more >
Using Static Files With Flask - Python and Flask #7 - YouTube
In this video I'll show you how to use Static Files with Flask and Python.Every website online uses static files...images, css, and javascript....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found