#ERROR: Expected "(" but found "\"./footer.css\"" Plugin: vite:esbuild

1 messages · Page 1 of 1 (latest)

mental roost
#

Hi,

I was trying to setup https://vite-pwa-org.netlify.app/frameworks/astro.html.
However, at some point I started getting this weird error:

20:58:46 [vite] Internal server error: Transform failed with 1 error:
D:/Repositories/five-dice/src/app/src/layouts/footer.astro?astro&type=script&index=0&lang.ts:2:7: ERROR: Expected "(" but found "\"./footer.css\""
  Plugin: vite:esbuild
  File: D:/Repositories/five-dice/src/app/src/layouts/footer.astro?astro&type=script&index=0&lang.ts:2:7

  Expected "(" but found "\"./footer.css\""
  1  |  ---
  2  |  import "./footer.css";
     |         ^
  3  |
  4  |  import NewIcon from "../icons/iconmonstr-plus-lined.svg?raw" ;

      at failureErrorWithLog (D:\Repositories\five-dice\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1604:15)     
      at D:\Repositories\five-dice\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:837:29
      at responseCallbacks.<computed> (D:\Repositories\five-dice\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:701:9)
      at handleIncomingPacket (D:\Repositories\five-dice\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:756:9)      
      at Socket.readFromStdout (D:\Repositories\five-dice\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:677:7)     
      at Socket.emit (node:events:513:28)
      at addChunk (node:internal/streams/readable:324:12)
      at readableAddChunk (node:internal/streams/readable:297:9)
      at Readable.push (node:internal/streams/readable:234:10)
      at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

I already tried switching back to the main branch and nuking the node_modules folders but I keep getting this.
What could be causing this?

tender rover
#

What version of astro are you using?

mental roost
#

2.0.0

#

I think I've found it... kind of.
I unregistered the service worker and now it works again

#

That's at least cause of the persistence, but I don't understand what's causing the error

tender rover
#

Nice, glad you got it fixed!

mental roost
#

Well I solved the persistence issue.
However, now my pwa plugin doesn't seem to work:

tender rover
#

Ah I misunderstood it

#

I'm not familiar with this library though, but I'll get back to you if I find something

mental roost
mental roost
tender rover
#

Did you try restarting the dev server?

mental roost
#

Yes, a couple of times haha

tender rover
#

Maybe you could try updating astro to latest?

mental roost
#

Ah good find.
I'll give that a go tomorrow and I'll let you know what happened

tender rover
#

Sounds good 👍

mental roost
#

I gave it a try. However, now I'm getting window is not defined in solid code that used to work so I'm going to need some more time

mental roost
#

I got it working again, strangely enough it's this setting that got it working again:

#

I'm back to the previous error now.
It appears that this happens when I stop the dev server and then start it again:

#

registerType: 'autoUpdate', seems to have fixed this 🎊

#

Well, it now only fails on start but then on hard refresh it updates itself

mental roost
#

@tender rover any suggestions on how I might fix the initial faillure?

tender rover
mental roost
#

No worries, is there maybe something I can do to get more diagnostic data?

tender rover
#

Not sure but I you have a reproduction maybe I could help

mental roost
#

You should be able to just go:

pnpm install
cd ./src/app
pnpm dev
#

If you're not able to reproduce it, that's also cool.
Then it's a my machine issue haha

tender rover
tender rover
#

Using codespaces btw

mental roost
#

Interesting, I'm running it on windows 11 through the git bash terminal
Maybe it's a windows thing?

#

I'll see if I can run it on my other laptop on elementary os, just to see

mental roost
#

Well nevermind that, it's 2 major versions behind and it won't even updat Google Chrome 😅

#

I will give it a go on my work pc, which is also windows