Enderchief / gleam-tools

monorepo for vite-gleam & ts-gleam
MIT License
36 stars 5 forks source link

Setting the `config.watch` to `{}` forces `vite build` to watch #2

Closed rawhat closed 6 months ago

rawhat commented 6 months ago

Hello! This is great, and I'm using it for an npx vite dev perfectly.

When I go to build for production with npx vite build, it's in --watch mode even without specifying that anywhere in my Vite config.

Here is the output:

δ npx vite build
vite v4.5.0 building for production...

watching for file changes...

build started...
$ gleam build
   Compiled in 0.00s

transforming (4) build/dev/javascript/client/client.mjs
✓ 32 modules transformed.
dist/index.html                 0.36 kB │ gzip: 0.27 kB
dist/assets/index-43cf1102.css  4.54 kB │ gzip: 1.38 kB
dist/assets/index-6e6d807d.js   9.14 kB │ gzip: 3.58 kB
built in 577ms.
^C⏎

I think maybe this stuff https://github.com/Enderchief/gleam-tools/blob/master/packages/vite-gleam/src/index.ts#L60 should be conditionally set? I'm not sure if passing --watch does anything to the config. If so, that would be easy enough to check.

Thanks!

Enderchief commented 6 months ago

You are right about the issue. I fixed the issue with vite-gleam 0.4.0 (I forgot to push it to master but it's published on NPM since November 22). What version of the plugin are you using?

rawhat commented 6 months ago

Oof, I'm really sorry. I somehow had a very old version? And then seeing the code on the master branch, I guess I didn't think to check that. Thanks for the info!

Enderchief commented 6 months ago

Oof, I'm really sorry. I somehow had a very old version? And then seeing the code on the master branch, I guess I didn't think to check that. Thanks for the info!

no worries. it's my bad since I didn't push my code to github until yesterday