gracile-web / gracile

A thin, full-stack, web framework — Powered by Vite and Lit SSR. Works with Node's HTTP or WHATWG Fetch.
https://gracile.js.org
ISC License
24 stars 1 forks source link

Minimal server template build fails due to backslashes in import paths on Windows #7

Closed zaunt closed 1 month ago

zaunt commented 1 month ago

I'm using Windows. I've created a new Gracile project (using pnpm create gracile@latest and choosing the Hono option). I'm getting the following error when I run pnpm build.

pnpm build

> @gracile/template--minimal-server-hono@0.0.2 build
> vite build

vite v5.4.2 building for production...
✓ 33 modules transformed.
dist/client/assets/index-B-aIcIlN.css            0.05 kB │ gzip: 0.05 kB
dist/client/assets/document-B0Vc8RBx.css         0.18 kB │ gzip: 0.14 kB
dist/client/assets/index-hhDAdDi9.js            10.19 kB │ gzip: 3.68 kB
dist/client/assets/document.client-BozJLpjF.js  14.45 kB │ gzip: 5.80 kB
✓ built in 476ms
vite v5.4.2 building SSR bundle for production...
✓ 2 modules transformed.
x Build failed in 16ms
error during build:
gracile:routes (52:35): Legacy octal escape is not permitted in strict mode (Note that you need plugins to import files that are not JavaScript)
file: gracile:routes:52:35

50:   [
51:     ['/', () => import('/src\routes\(home).ts')],
52: ['/404/', () => import('/src\routes\404.ts')],
                                       ^
53: ['/about/', () => import('/src\routes\about.ts')],
54: ['/api/:path*/', () => import('/src\routes\api\[...path].ts')],

RollupError: Legacy octal escape is not permitted in strict mode

The problem is that the paths in the import statements contain backslashes (actually they contain a mixture of forward and backslashes). The string \404 is being interpreted as a legacy octal syntax.

The paths need to have the backslashes turned into forward slashes (or be escaped).

JulianCataldo commented 1 month ago

Thank you! Missed that. It's an easy fix.

I'll take the time to setup a proper OSes env. matrix for the GH workflow.

JulianCataldo commented 1 month ago

Fix available in the latest main release