Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Vite can't find resources when the "web resources" directory lives in a different place #13

Open
bphenriques opened this issue Oct 15, 2023 · 0 comments

Comments

@bphenriques
Copy link

bphenriques commented Oct 15, 2023

Hello!

Trying to tidy up a project so that the usual web resources live within the same subdirectory web:

.
├── README.md
├── build.sbt
├── project
│   ├── build.properties
│   └── plugins.sbt
├── src
│   └── main
│       └── scala
│           └── livechart
│               └── LiveChart.scala
└── web
    ├── index.html
    ├── javascript.svg
    ├── main.js
    ├── package-lock.json
    ├── package.json
    ├── public
    │   └── vite.svg
    ├── style.css
    └── vite.config.js

I have updated vite.config.js accordingly to point to the parent directory but it then fails to find resources installed node_modules:
image

How to reproduce

Example repo that attempts to reproduce: https://github.com/bphenriques/issue-rd-scalajs-sbt-vite-laminar-chartjs-example/tree/scalajs-vite-end-state (branch scalajs-vite-end-state).

It is built on top of the usual scalajs-vite tutorial: https://www.scala-js.org/doc/tutorial/scalajs-vite.html

  1. Migrate to Slinky with a basic setup which works out of the box - this discards issues with React or Slinky as far as I can tell).
  2. Move HTML files to web (commit):

Variations:

  1. Have package.json, package-lock.json, and node_modules to the root - does not work.

I am likely doing something wrong and this is perhaps intended, in that case, what would be the "standard" structure that resembles what I inded?

Environment:

$ npm --version
9.5.1

If relevant, MacOS.

Thank you!

@bphenriques bphenriques changed the title Vite can't find resources when the `node_o a non-standard "web resources" directory Vite can't find resources when the "web resources" directory lives in a different place Oct 15, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant