I'm migrating a React Webpack project into a SolidJS Parcel project. However, the combination of SolidJS and Parcel seems to have problems with nested Typescript projects, which combinations of React and Webpack do not have.
In my minimal example project, I get the error: @parcel/core: Failed to resolve 'solid-js/jsx-runtime' from './foo/src/index.tsx'
. If I try to rename, index.tsx
into index.jsx
, Parcel can build the same file without any error. However, I want to use Typescript instead of JavaScript.
/.babelrc:
{
"presets": [ "solid" ]
}
/package.json:
{
"private": true,
"dependencies": {
"solid-js": "1.3.12"
},
"devDependencies": {
"babel-preset-solid": "1.3.12",
"parcel": "2.3.2",
"typescript": "4.6.2"
}
}
/tsconfig.json:
{
"compilerOptions": {
"isolatedModules": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"lib": [
"dom",
"es2021"
],
"module": "commonjs",
"noEmit": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"sourceMap": true,
"strict": true,
"target": "es5"
}
}
/foo/src/index.tsx:
export function HelloWorld() {
return <div>Hello World!</div>;
}
/foo/package.json:
{
"private": true,
"source": "src/index.tsx",
"scripts": {
"parcel:build": "npx parcel build"
}
}
How can I fix the error @parcel/core: Failed to resolve 'solid-js/jsx-runtime
in my nested Typescript project?