vanjs-org / van

🍦 VanJS: World's smallest reactive UI framework. Incredibly Powerful, Insanely Small - Everyone can build a useful UI app in an hour.
https://vanjs.org
MIT License
3.77k stars 87 forks source link

[vanjs-jsx] Add missing ./src/jsx-runtime.js #325

Open damienflament opened 3 months ago

damienflament commented 3 months ago

Hi !

I'm configuring Vite to transform JSX using vanjs-jsx.

It's a JavaScript project so I don't do configuration in the tsconfig.json file but in vite.config.js :

import { defineConfig } from 'vite'

export default defineConfig({
  ...
  esbuild: {
    jsx: 'automatic',
    jsxImportSource: 'vanjs-jsx'
  }
})

It's working fine using the development server. But when building, vanjs-jsx/jsx-runtime is not found.

Patching the package using Yarn by adding the missing file fix the issue.

Thanks.

Tao-VanJS commented 3 months ago

@cqh963852, could you take a look at this issue?

cqh963852 commented 3 months ago

The path to jsx-runtime.js is defined in package.json.

Could it be that esbuild is using an old specification for path lookup?

Maybe this line should be adjusted

https://github.com/vanjs-org/van/blob/fdffbbd60163dd32e85d5409e74849f526e0c1cf/addons/van_jsx/package.json#L14

  "require": "./src/index.js",
  "import": "./src/index.js",
  "types": "./src/jsx-runtime.d.ts"
cqh963852 commented 3 months ago

I checked the history, this should be a modification error

image