diff --git a/coldspa/vite/plugin.js b/coldspa/vite/plugin.js index e6ec12e..9b7a3b0 100644 --- a/coldspa/vite/plugin.js +++ b/coldspa/vite/plugin.js @@ -36,6 +36,11 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); // here so our id-based lookups work on Windows. const toViteId = (p) => resolve(p).split('\\').join('/'); +function normalizeViteId(id) { + const cleanId = id.split('?')[0]; + return cleanId.startsWith('/@fs/') ? cleanId.slice('/@fs/'.length) : cleanId; +} + const FRAMEWORK_CLIENTS = { vue: toViteId(resolve(__dirname, 'clients/vue-client.js')), react: toViteId(resolve(__dirname, 'clients/react-client.js')) @@ -242,8 +247,8 @@ export default function coldspa(options = {}) { // import map). enforce: 'pre', transform(code, id) { - // id may include a query string (?import, ?used, etc); strip it - const cleanId = id.split('?')[0]; + // id may include a query string or Vite's /@fs/ prefix. + const cleanId = normalizeViteId(id); const glob = globsByClientPath[cleanId]; if (!glob) return null; if (!code.includes(GLOB_PLACEHOLDER)) return null; @@ -260,4 +265,3 @@ export default function coldspa(options = {}) { } ]; } - diff --git a/coldspa/vite/ssr-server.js b/coldspa/vite/ssr-server.js index 7e2b012..2f24d6d 100644 --- a/coldspa/vite/ssr-server.js +++ b/coldspa/vite/ssr-server.js @@ -28,15 +28,19 @@ import { fileURLToPath, pathToFileURL } from 'url'; import { dirname, resolve } from 'path'; const __dirname = dirname(fileURLToPath(import.meta.url)); -const PROJECT_ROOT = resolve(__dirname, '..', '..'); // webroot +const PROJECT_ROOT = resolve(process.cwd()); const PORT = Number(process.env.COLDSPA_SSR_PORT || 5174); const HOST = process.env.COLDSPA_SSR_HOST || '0.0.0.0'; const IS_PROD = process.env.NODE_ENV === 'production'; +function toViteFsId(path) { + return `/@fs/${path.split('\\').join('/')}`; +} + // Map :framework path segment -> SSR module entry path / id const SSR_ENTRIES_DEV = { - vue: '/coldspa/vite/clients/vue-ssr.js', - react: '/coldspa/vite/clients/react-ssr.js' + vue: toViteFsId(resolve(__dirname, 'clients/vue-ssr.js')), + react: toViteFsId(resolve(__dirname, 'clients/react-ssr.js')) }; const SSR_ENTRIES_PROD = { vue: resolve(PROJECT_ROOT, 'dist-ssr', 'vue-ssr.js'), -- 2.51.2 From 7911c6663eca611a0ccee4a1868a9959a781ffba Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Fri, 19 Jun 2026 22:22:46 -0700 Subject: [PATCH 2/2] chore: bump version --- .gitignore | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9cbee4a..cb21ea4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ node_modules/ dist/ dist-ssr/ coldspa.config.json -modules/ \ No newline at end of file +modules/ +.DS_Store \ No newline at end of file diff --git a/package.json b/package.json index 70e68f2..967fb2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coldspa", - "version": "0.3.0", + "version": "0.3.1", "description": "Give your CFML a spa day. The Islands Architecture for ColdFusion.", "type": "module", "license": "MIT",