parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.46k stars 2.27k forks source link

Parcel not working with HyperHTML (import package sub-folder) #477

Closed ghost closed 6 years ago

ghost commented 6 years ago

Parcel Bundler: 1.4.1 Node: 8.9.3 OS: Windows 10 HyperHTML: 2.4.3

HyperHTML builds different module types into sub-folders (e.g. /esm /cjs). It differentiates for bundlers using the standard keys main and module in package.json.

{
  "main": "cjs/index.js",
  "module": "esm/index.js",
}

Importing from the package root is not working with parcel. Parcel does not throw an error, but when running the code, the import hyper reference is an empty object.

import hyper from 'hyperhtml'

To import using parcel requires including the sub-folder in the import:

import hyper from 'hyperhtml/esm'

I think that parcel should support the main and module keys.

brandon93s commented 6 years ago

Related to #418 & #298.

ghost commented 6 years ago

Confirmed the issue is with the main and module pointing to files in sub-folders. I added an index file in the root folder that just re-exports the file from the sub-folder and updated the module to point to the root file and it worked.

DeMoorJasper commented 6 years ago

Closing as #418 & #298 have been resolved.