Vite has an internal check that limits CommonJS detection to only bare specifier. This doesn't work well together with us resolving npm modules to absolute file paths. https://github.com/vitejs/vite/blob/main/packages/vite/src/node/ssr/fetchModule.ts#L46 I've tried re-using our own instance of `@rollup/plugin-commonjs` or `esbuild` but couldn't get these to work in that setup. The easiest way seems to be to just write our own CJS -> ESM translation layer. With a little luck since the Deno ecosystem is heavy into ESM we might get away with this. In either way this removes one of the two blockers to using the vite plugin.
29 lines
817 B
JSON
29 lines
817 B
JSON
{
|
|
"name": "@fresh/plugin-vite",
|
|
"version": "0.0.1",
|
|
"license": "MIT",
|
|
"exports": {
|
|
".": "./src/mod.ts"
|
|
},
|
|
"compilerOptions": {
|
|
"jsx": "precompile",
|
|
"jsxImportSource": "preact"
|
|
},
|
|
"tasks": {
|
|
"demo": "vite demo",
|
|
"debug": "deno run -A --inspect-brk npm:vite demo",
|
|
"demo:build": "vite build demo",
|
|
"demo:start": "cd demo && deno serve -A _fresh/server/server-entry.mjs"
|
|
},
|
|
"imports": {
|
|
"@babel/core": "npm:@babel/core@^7.28.0",
|
|
"@deno/loader": "jsr:@deno/loader@^0.3.2",
|
|
"@prefresh/vite": "npm:@prefresh/vite@^2.4.8",
|
|
"@types/babel__core": "npm:@types/babel__core@^7.20.5",
|
|
"@types/node": "npm:@types/node@^24.1.0",
|
|
"preact": "npm:preact@^10.26.9",
|
|
"vite": "npm:vite@^7.0.6",
|
|
"vite-plugin-inspect": "npm:vite-plugin-inspect@^11.3.2"
|
|
}
|
|
}
|