Parcel fails to resolve preact/jsx-dev-runtime
when running in development. It appears not to properly resolve this module as specified in "exports"
in Preact's package.json
.
- Clone this repo
yarn install
yarn start
You'll get the following:
Server running at http://localhost:1234
🚨 Build failed.
@parcel/core: Failed to resolve 'preact/jsx-dev-runtime' from './src/app.jsx'
/Users/joe/code/playground/parcel-preact-error/src/app.jsx:1:1
> 1 | export default function App() {
> | ^
2 | return <div>This is content</div>;
3 | }
You can get around this issue by adding an entry for preact/jsx-dev-runtime
in package.json
's alias
field. For example:
"alias": {
"preact/jsx-dev-runtime": "preact/jsx-runtime/dist/jsxRuntime.module.js"
}