Skip to content

Svelte preprocessor gives false message #4062

@ghost

Description

Describe the bug

I have the following code:

<svelte:head>
  {#if browser}
    <script src="/app.js"></script>
  {/if}
</svelte:head>

This code does work but I get the following message in my yarn dev terminal: [svelte-preprocess] The file "/app.js" was not found.

app.js is saved in the static directory.

Reproduction

Have the following code snippet in some .svelte file.

<script lang="ts">
  import { browser } from '$app/env';
</script>

<svelte:head>
  {#if browser}
    <script src="/app.js"></script>
  {/if}
</svelte:head>

Logs

yarn run v1.22.17
warning package.json: No license field
$ svelte-kit dev

  SvelteKit v1.0.0-next.260

  local:   http://localhost:3000
  network: not exposed
  network: not exposed

  Use --host to expose server to other devices on this network


[svelte-preprocess] The file  "/cookie.js" was not found.
[svelte-preprocess] The file  "/app.js" was not found.
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:70:0 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:86:4 A11y: <h1> element should have child content
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:102:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:103:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:104:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:121:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:125:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:129:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:133:0 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:150:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:165:6 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:179:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:182:0 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:195:8 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:202:35 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:209:0 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:224:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:227:0 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:230:4 A11y: <img> element should have an alt attribute
9:51:10 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:241:4 A11y: <img> element should have an alt attribute
[svelte-preprocess] The file  "/cookie.js" was not found.
[svelte-preprocess] The file  "/app.js" was not found.
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:70:0 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:86:4 A11y: <h1> element should have child content
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:102:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:103:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:104:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:121:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:125:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:129:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:133:0 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:150:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:165:6 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:179:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:182:0 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:195:8 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:202:35 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:209:0 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:224:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:227:0 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:230:4 A11y: <img> element should have an alt attribute
9:51:11 PM [vite-plugin-svelte] /home/chris/fnl/frontend/src/routes/index.svelte:241:4 A11y: <img> element should have an alt attribute

System Info

System:
    OS: Linux 5.15 Gentoo/Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
    Memory: 13.39 GB / 15.57 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 17.5.0 - ~/.nvm/versions/node/v17.5.0/bin/node
    Yarn: 1.22.17 - /usr/bin/yarn
    npm: 8.4.1 - ~/.nvm/versions/node/v17.5.0/bin/npm
  Browsers:
    Chromium: 98.0.4758.102
    Firefox: 91.6.0esr
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.17
    @sveltejs/adapter-node: ^1.0.0-next.68 => 1.0.0-next.68
    @sveltejs/kit: next => 1.0.0-next.260
    svelte: ^3.46.0 => 3.46.4

Severity

annoyance

Additional Information

cookie.js is the exact same case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions