Marvin Hagemeister
efef51714b
fix(vite): unable to load transpiled commonjs with node builtins ( #3541 )
2025-10-08 12:47:04 +02:00
Marvin Hagemeister
4b069ee0d0
fix(vite): empty commonjs files with only __esModule ( #3540 )
...
When modules only contain the `__esModule` flag, we still need to add
the `exports` and `module.exports` initializers.
2025-10-08 11:50:34 +02:00
Marvin Hagemeister
6c03a9bc26
fix(vite): support jsx namespaces ( #3539 )
...
Babel throws when encountering jsx namespaces by default. It needs a
setting to not throw.
2025-10-08 11:30:07 +02:00
Marvin Hagemeister
63dd77a319
fix(vite): dev server not recovering on syntax error ( #3507 )
...
Fixes https://github.com/denoland/fresh/issues/3506
2025-09-29 19:03:02 +02:00
fry69 and Marvin Hagemeister
f7a2422e93
fix: set nodeModulesDir to manual ( #3493 )
...
Hopefully a less invasive fix for #3378
---------
Co-authored-by: Marvin Hagemeister <hello@marvinh.dev >
2025-09-25 20:54:27 +02:00
Marvin Hagemeister
9b83a1e1b3
fix(vite): cover more commonjs cases ( #3465 )
...
Fixes https://github.com/denoland/fresh/issues/3463
Fixes https://github.com/denoland/fresh/issues/3449
2025-09-19 18:36:51 +02:00
Marvin Hagemeister
69ad9bc3c1
fix(vite): improve cjs esm detection + builtins resolution ( #3457 )
2025-09-16 19:41:22 +02:00
Marvin Hagemeister
9a2098ecba
fix(vite): ensure plugins are only instantiated once ( #3450 )
...
This makes debugging a lot easier as by default vite instantiates
plugins multiple times for each environment.
2025-09-16 11:35:00 +02:00
Marvin Hagemeister
399cbc3aa2
fix(vite): nested islands not working ( #3440 )
...
This PR makes nested islands work. Problem was that only entry files
have the `src` property in the vite manifest. For that we need to ensure
that every island is an entry point.
Fixes https://github.com/denoland/fresh/issues/3439
2025-09-15 17:55:44 +02:00
Marvin Hagemeister
3fb3cd9443
fix(vite): route css import ( #3438 )
...
Fixes https://github.com/denoland/fresh/issues/3426
2025-09-15 13:20:07 +02:00
Marvin Hagemeister
b31f36265c
fix(vite): keep require calls in ESM file ( #3433 )
...
Detect if a file is ESM based on file extension or finding ESM-only
statements. When we know that it's an ESM file we should keep
`require()` calls as is, because some libraries use it as a conditional
check like `npm:motion`.
Fixes https://github.com/denoland/fresh/issues/3429
2025-09-15 10:40:09 +02:00
Marvin Hagemeister
8a996a428a
fix(vite): missing build id in Deno Deploy EA ( #3414 )
...
Fixes https://github.com/denoland/fresh/issues/3282
2025-09-12 15:24:26 +02:00
Marvin Hagemeister
e06f03ac67
fix: add missing compile entry ( #3410 )
...
Fixes https://github.com/denoland/fresh/issues/3409
2025-09-12 13:08:49 +02:00
Marvin Hagemeister
7ce6aeff8b
fix(vite): workaround for FOUC with tailwind ( #3407 )
...
Fixes https://github.com/denoland/fresh/issues/3379
2025-09-12 12:34:23 +02:00
Marvin Hagemeister
e5bc9194e9
fix(vite): drop trailing or leading whitespace in build id ( #3408 )
...
Fixes https://github.com/denoland/fresh/issues/3406
2025-09-12 12:33:13 +02:00
Marvin Hagemeister
9581d7e6d4
fix(vite): remove Deno global check ( #3401 )
...
Ultimately, it causes more problems than it solves.
2025-09-12 10:01:37 +02:00
fry69
6fbe0ddcc4
fix(vite): basePath handling for static assets ( #3394 )
...
closes #3391
---
Generated PR message:
Fix base path handling for assets in plugin-vite
Fixes issue where Fresh apps mounted at non-root paths (e.g., /ui) in
frameworks like Hono would fail to load assets correctly.
Problem
When mounting a Fresh app with app.mount('/ui', UI.fetch), the HTML
would load but all assets (CSS, JS, images) would return 404 because
asset paths
were hardcoded to start with /assets/ instead of respecting the Vite
base configuration.
Solution
- Modified packages/plugin-vite/src/plugins/server_entry.ts to read
Vite's base config and apply it to asset paths
- Added getAssetPath() helper function to construct proper asset URLs
with base path
- Updated both CSS and asset file registration to use the base path
Testing
Added comprehensive test case "vite build - base path asset handling"
that:
- Builds demo with custom base path /my-app/
- Verifies generated server.js contains correctly prefixed asset paths
- Follows existing test patterns and utilities
Usage
Users can now properly mount Fresh apps by configuring both:
```ts
// vite.config.ts
export default defineConfig({
base: "/ui/",
plugins: [fresh()],
});
// main.ts
const app = new App({ basePath: "/ui" });
// hono-app.ts
app.mount('/ui', UI.fetch); // Assets now work correctly
```
Backward compatible - no changes needed for apps mounted at root path.
2025-09-11 16:07:15 +02:00
Lach
5781123157
fix(vite): allow optional property access to Deno global ( #3370 )
...
Ideally, those expressions should be replaced with undefined for better
code optimizations, yet I haven't figured it out the best way for this.
Fixes:
https://github.com/denoland/fresh/issues/3296#issuecomment-3270452525
2025-09-09 15:17:36 +02:00
Marvin Hagemeister
8743322968
feat(vite): serve static index.html files ( #3358 )
...
Fixes https://github.com/denoland/fresh/issues/3356
2025-09-08 17:36:30 +02:00
Marvin Hagemeister
2e015cd2b9
fix(vite): improve commonjs handling ( #3357 )
2025-09-08 17:06:11 +02:00
Marvin Hagemeister
2c32ffe8f3
fix(vite): support ssr css modules ( #3355 )
...
Fixes https://github.com/denoland/fresh/issues/3325
2025-09-08 16:23:13 +02:00
Marvin Hagemeister
185ab95751
fix(vite): get radix-ui working ( #3344 )
2025-09-05 16:51:22 +02:00
Marvin Hagemeister
4138b8ca66
fix(vite): improve commonjs handling ( #3336 )
...
Fixes https://github.com/denoland/fresh/issues/3323
2025-09-04 12:59:13 +02:00
Marvin Hagemeister
b94aab2a1a
chore: update to vite's hook filter ( #3333 )
...
Fixes https://github.com/denoland/fresh/issues/3331
2025-09-04 11:16:06 +02:00
Marvin Hagemeister
08ef05fc1d
fix(vite): pathname treated as static file ( #3326 )
...
Fixes https://github.com/denoland/fresh/issues/3322
2025-09-03 11:34:19 +02:00
Marvin Hagemeister
0d94bb0405
fix(vite): inline import.meta.env.* ( #3306 )
2025-09-02 09:55:21 +02:00
Marvin Hagemeister
ae2a27e174
feat(vite): error when using Deno global in the browser ( #3305 )
...
Related https://github.com/denoland/fresh/issues/3296
2025-09-01 19:56:31 +02:00
Marvin Hagemeister
ff9db336f7
feat(vite): check valid imports per environment ( #3299 )
...
Fixes https://github.com/denoland/fresh/issues/3296
2025-09-01 17:30:30 +02:00
Marvin Hagemeister
541bc6c6ca
feat(vite): support remote islands ( #3294 )
2025-09-01 12:11:08 +02:00
Marvin Hagemeister
b41c151de3
fix(vite): serve css imported in islands ( #3272 )
...
Fixes https://github.com/denoland/fresh/issues/3271
2025-08-29 14:30:00 +02:00
Marvin Hagemeister
b2c4f049bc
fix(vite): island hmr ( #3269 )
2025-08-28 15:47:55 +02:00
Marvin Hagemeister
b0e75b7199
fix(vite): add back support for Preact DevTools ( #3266 )
2025-08-27 09:43:39 +02:00
Marvin Hagemeister
4803f2d80b
fix(vite): disable babel code size warning ( #3265 )
2025-08-27 09:43:23 +02:00
Marvin Hagemeister
111fe8063d
fix(vite): use better node -> fetch request polyfill ( #3267 )
2025-08-27 09:29:24 +02:00
Marvin Hagemeister
bdf560ce22
fix(vite): reload page on route change ( #3263 )
2025-08-26 14:46:04 +02:00
Marvin Hagemeister
a743b0c5d3
fix(vite): account for query params in module ids ( #3257 )
2025-08-26 09:35:27 +02:00
Marvin Hagemeister
bf25d10a84
fix(vite): support commonjs module.exports assignment ( #3247 )
2025-08-25 08:48:34 +02:00
Marvin Hagemeister
9975d1698f
fix(vite): client hmr ( #3246 )
2025-08-22 15:42:09 +02:00
Marvin Hagemeister
d1f7d49466
fix(vite): importing node:* builtins ( #3245 )
2025-08-22 13:58:39 +02:00
Marvin Hagemeister
138784a58e
fix(vite): address more commonjs scenarios ( #3244 )
2025-08-22 13:46:15 +02:00
Marvin Hagemeister
5c3fe27046
chore: refactor tests ( #3243 )
2025-08-22 12:14:19 +02:00
Marvin Hagemeister
873c54bd5f
feat(vite): get rid of unnecessary polyfills ( #3242 )
2025-08-22 11:23:57 +02:00
Marvin Hagemeister
27c2910b1d
fix(vite): babel transform being applied for non-js files ( #3238 )
2025-08-21 20:03:00 +02:00
Marvin Hagemeister
105ffe55ee
fix(vite): only transform js-like files in deno loader ( #3234 )
2025-08-21 14:29:13 +02:00
fry69 and Marvin Hagemeister
9f09786b06
feat(vite): read build id from env if present ( #3233 )
...
Fix #3232
Disclaimer: This code was mostly generated by GitHub Copilot agent using
Sonnet-4, but tested and verified by me.
---------
Co-authored-by: Marvin Hagemeister <marvin@deno.com >
2025-08-21 13:31:45 +02:00
Marvin Hagemeister
ffa57be765
fix(vite): partial island loading ( #3226 )
2025-08-19 17:58:17 +02:00
Marvin Hagemeister
afdf5eaf6c
fix(vite): asset handling ( #3225 )
...
This PR reworks asset handling in our vite plugin. Importing assets in
js is now supported.
2025-08-19 16:45:33 +02:00
Marvin Hagemeister
f80d049dca
fix(vite): inline FRESH_PUBLIC_* env vars ( #3221 )
2025-08-16 23:14:03 +02:00
Marvin Hagemeister
59549c9532
fix(vite): npm resolution + cjs + duplicated preact signals ( #3211 )
2025-08-16 19:26:39 +02:00
Marvin Hagemeister
d026375c3e
fix(vite): error when npm package requires json files ( #3210 )
2025-08-08 14:16:38 +02:00