Skip to content

Improper import in route does not throw but builds nothing #5413

Closed
@iverks

Description

@iverks

Describe the bug

When a page (a .svelte-file in the src/routes directory) has a broken import:
I run npm run build.
No errors are thrown, no warnings are given and the site doesnt build.

Expected behaviour would be one of:

  • Build fails with error
  • Build succeeds with warning
  • Build succeeds without warning, but throws in runtime

Reproduction

https://github.com/iverks/sveltekit_import_bug

npm install
npm run build - nothing gets built, but no errors

Then you can comment out the import in index.svelte, and it builds just fine

Logs

PS C:\Users\ivism\Progging\bug> npm run build
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> bug@0.0.1 build
> vite build

vite v2.9.13 building for production...
✓ 13 modules transformed.

System Info

Testen on Windows 10 and windows 11.

From win10:
  System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 4.37 GB / 15.71 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.423.0), Chromium (103.0.1264.44)
    Internet Explorer: 11.0.19041.1

Severity

serious, but I can work around it

Additional Information

About severity: I guess it could be considered "annoying", but its terrible DX and was almost impossible to debug.
Tested with adapter-node and adapter-static.
This is using the latest package.json, vite.config.js, svelte.config.js setup supplied by npm create svelte app-name

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions