Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add index output to rollup config #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add index output to rollup config #32

wants to merge 1 commit into from

Conversation

adamjanicki2
Copy link
Contributor

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

Copy link

netlify bot commented Apr 28, 2024

Deploy Preview for treecle ready!

Name Link
🔨 Latest commit cbb7867
🔍 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
Copy link
Member

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
Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants