I've tried to use the SolidJS
+Parcel
+TypeScript
template starter project from here:
https://github.com/TiagoCavalcante/solidts-parcel
And once I import any element from @suid/material
, such as Button
, build fails.
Here's how to reproduce:
- Checkout project template from the about URL.
npm i --save @suid/material
- Put the following in
index.tsx
:
import { render } from "solid-js/web";
import SuidButton from '@suid/material/Button'
function App() {
return <>
<SuidButton>Testing</SuidButton>
</>;
}
render(App, document.getElementById("app")!);
You will get an error output:
Build failed.
@parcel/transformer-js: Expected ',', got 'ownerState'
C:\Users\alona\dev\parcel\node_modules\@suid\material\Button\Button.jsx:307:25
306 | const contextProps = useContext(ButtonGroupContext);
> 307 | Root ownerState={allProps} className={clsx(classes.root, otherProps.className, contextProps.className)} disabled={props.disabled} focusRipp
> | ^^^^^^^^^^
308 | <Show when={!!props.startIcon}>
309 | <ButtonStartIcon className={classes.startIcon} ownerState={allProps}>
My question is, how can I make it play well with @suid/material
?
it works fine when using ViteJS
instead of Parcel
This issue seems related:
https://github.com/parcel-bundler/parcel/issues/6176
I asked on their discord, and apparently Parcel
doesn't really support non-standard JS syntax in node_modules (like Typescript or JSX).
This means, that @suid/material
cannot be used with Parcel
, as well as others such as https://github.com/LXSMNSYC/solid-headless