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

bug: vite binary crashes during hosting a static build #17713

Closed
7 tasks done
laciferin2024 opened this issue Jul 18, 2024 · 11 comments
Closed
7 tasks done

bug: vite binary crashes during hosting a static build #17713

laciferin2024 opened this issue Jul 18, 2024 · 11 comments

Comments

@laciferin2024
Copy link

laciferin2024 commented Jul 18, 2024

Describe the bug

Static Build:

build.zip

Reproduction [minimal]

docker run -p 8080:8080 ghcr.io/z-auth/zauth:feat-transactions

On Other file hosting binaries...

  1. Python3

python3 -m http.server -d build/ 8080

It works absolutely fine.

  1. Chrome extensions

  2. Turn on developer mode in extensions

  3. Load unpacked : and add the extracted build folder.

Reproduction

https://bit.ly/install-zauth

Steps to reproduce

Reproduction:

  1. unpack build
  2. bun install [email protected] #Reproducing in npm, yarn as well
  3. bunx vite build/ --port 8080
  4. Go to localhost:8080 in ur browser: preferably chrome.

Error:

app.9eecbb9e.js:1 SyntaxError: The requested module '/app/immutable/chunks/___vite-browser-external_commonjs-proxy.d28e07b6.js' does not provide an export named 'default' (at index.78fa3162.js:1:268)

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 62.28 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.1 - /opt/homebrew/bin/npm
    pnpm: 9.1.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.13 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 126.0.6478.182
    Safari: 17.5
  npmPackages:
    vite: ^4.5.3 => 4.5.3

Used Package Manager

bun

Logs

No critical Logs found in `bun

Validations

Copy link

Hello @laciferin2024. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@sapphi-red
Copy link
Member

We need the source code that generates the invalid output to investigate.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
@laciferin2024
Copy link
Author

@sapphi-red the framework that source code is written is sveltekit. I have attached the static code failing for vite [exclusively]. Its not the source code nor the static build the issue. Cuz the generated build is working just fine in chrome and gulp. I have definitely provided the minimum reproduction that was asked for.

@sapphi-red
Copy link
Member

So you're trying to build the file output by sveltekit by vite (otherwise there's no reason to run vite dev instead of vite preview)?

@laciferin2024
Copy link
Author

Thanks @sapphi-red ,

mv build dist
vite preview

is working. But when I tried vite preview ./build it didn't work.

@sapphi-red
Copy link
Member

vite preview --outDir build would work.

@laciferin2024
Copy link
Author

laciferin2024 commented Aug 19, 2024

vite preview --outDir build would work.

Its working

Although I get the error:

(!) build.outDir must not be the same directory of root or a parent directory of root as this could cause Vite to overwriting source files with build outputs.

when i set --outDir .

@sapphi-red
Copy link
Member

That is expected as the message says.
Closing as it seems to be working.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2024
@laciferin2024
Copy link
Author

Yeah, but why is the vite dev command failing for the static build?

@sapphi-red
Copy link
Member

sapphi-red commented Aug 21, 2024

There is a edge case bug causing that, but Vite doesn't support building the output and I don't think it's worth fixing at this point. (since it's not what you are trying to achieve)

@laciferin2024
Copy link
Author

Thanks, I really appreciate all the support.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants