van icon indicating copy to clipboard operation
van copied to clipboard

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

Open damienflament opened this issue 1 year ago • 5 comments

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.

damienflament avatar May 19 '24 18:05 damienflament

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

Tao-VanJS avatar May 19 '24 18:05 Tao-VanJS

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 avatar May 24 '24 01:05 cqh963852

I checked the history, this should be a modification error

image

cqh963852 avatar May 24 '24 01:05 cqh963852

@damienflament @cqh963852 please check out the:

Powered by vite-plugin-vanjs.

thednp avatar Dec 24 '24 21:12 thednp

@thednp Hi, I have check the plugin vite-plugin-vanjs, I think this plugin brings a better practice than vanjs-jsx.

@Tao-VanJS Please mark vanjs-jsx as deprecated.

cqh963852 avatar Feb 01 '25 10:02 cqh963852