mavoweb / treecle

WIP. A toolbox for hierarchical JS objects.
https://treecle.mavo.io
MIT License
6 stars 0 forks source link

add index output to rollup config #32

Open adamjanicki2 opened 4 months ago

adamjanicki2 commented 4 months ago

Currently, to import Treecle via ESM, after npm installing, you have to write

import Treecle from "treecle/dist/treecle.js"

but it would be nice if you could just do

import Treecle from "treecle"

so this fix just adds an index.js to the output dist directory so that you can do that

netlify[bot] commented 4 months ago

Deploy Preview for treecle ready!

Name Link
Latest commit cbb78679356927049c913fbebfecd480477f8957
Latest deploy log https://app.netlify.com/sites/treecle/deploys/662e3678c31a8300087e96e9
Deploy Preview https://deploy-preview-32--treecle.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

LeaVerou commented 4 months ago

We don't need an index.js for this, just certain package.json fields (main, exports, not sure if there are others that are relevant).

adamjanicki2 commented 4 months ago

We don't need an index.js for this, just certain package.json fields (main, exports, not sure if there are others that are relevant).

Got it, currently the relevant fields are set to

"main": "./dist/treecle.cjs",
"module": "./dist/treecle.js",

I think the issue is the build is outputting a file called treecle.cjs.js, so the target for main is off. Is the correct fix to change the package to "main": "./dist/treecle.cjs.js", or to adjust the rollup config so that it names the file treecle.cjs?