Skip to content

joebeachjoebeach/parcel-preact-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error building preact with parcel in dev

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.

How to reproduce

  1. Clone this repo
  2. yarn install
  3. 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 | }

Workaround

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"
}

About

repro error compiling preact with parcel dev server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published