solid-dnd icon indicating copy to clipboard operation
solid-dnd copied to clipboard

Projects fail when used with Vite 3.1.0

Open timothyallan opened this issue 1 year ago • 4 comments

Vite 3.1.0 just got released, and won't run any projects with solid-dnd included. Downgrading to 3.0.9 works fine still though.

Not sure if it's a Vite thing, or something that was in solid-dnd that Vite just let slip until now? Seems Vite-y, as it's complaining about JSX, but the file is clearly .jsx? I figured I'd report here just in case.

Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
/Development/Web/project/node_modules/@thisbeyond/solid-dnd/dist/source/sortable-context.jsx:41:35
39 |      return <Context.Provider value={context}>{props.children}</Context.Provider>;
40 |  };
41 |  const useSortableContext = () => {
   |                                    ^
42 |      return useContext(Context) || null;
43 |  };

As far as I can tell, to replicate, just update any project using vite + solid-dnd to [email protected].

timothyallan avatar Sep 05 '22 17:09 timothyallan

Confirming this still happens with latest 0.7.0 release and Solid JS 1.5+

Looks like other packages in the Solid ecosystem are affected too.

martinpengellyphillips avatar Sep 07 '22 21:09 martinpengellyphillips

Also reported to Vite here in case they have pointers on how to fix. Interestingly it does not seem to occur for my other Solid project (solid-select).

martinpengellyphillips avatar Sep 12 '22 21:09 martinpengellyphillips

See also https://github.com/solidjs/vite-plugin-solid/issues/51

martinpengellyphillips avatar Sep 14 '22 21:09 martinpengellyphillips

PR to vite-plugin-solid issued. However, with that fix we will face a new issue with Vite: https://github.com/vitejs/vite/issues/10087#issuecomment-1248472685

martinpengellyphillips avatar Sep 15 '22 20:09 martinpengellyphillips

Closing as this should be resolved on latest of vite and vite-plugin-solid.

You may still need to add the following to your vite config though to avoid other errors:

optimizeDeps: {
  extensions: ["jsx"],
},

martinpengellyphillips avatar Oct 07 '22 20:10 martinpengellyphillips