-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
ESM version #337
Comments
Hey, this is a great idea, I'm definitely open to adding better ESM module support. I just hadn't gotten around to it yet. If you'd like to work on this I'd very much appreciate a PR. This blog post has some helpful info for supporting both types in one repo, but I am also open to other approaches. I guess I would just prefer not to break backwards compatibility. Thank you! |
Great, I'll check the post and work on this soon. The usage of Is tocbot used directly in node, or it's only for browsers? |
Ok sounds good. It is only used in browsers, not in node. Yeah, hopefully the private files can be declared with:
But I'm not sure how that would affect deeply nested files. Anyway, I think the files in |
I made some progress, now working on tests, hope to finish this weekend. This is my current exports API "exports": {
".": {
"require": "./dist/tocbot.cjs",
"import": "./dist/tocbot.mjs"
},
"./styles.css": "./dist/styles.css",
"./tocbot.css": "./dist/tocbot.css",
"./dist/tocbot.js": "./dist/tocbot.js",
"./dist/tocbot.min.js": "./dist/tocbot.min.js",
"./dist/styles.css": "./dist/styles.css",
"./dist/tocbot.css": "./dist/tocbot.css"
}, The files in For the bare module I'll export files too, but the build will be different. I was thinking of doing both CJS and ESM on the root, but if you say it's only for browsers, I can as well just remove the CJS one, which would simplify things even further, but in case someone needs a CJS one, we can add it later, it's a new entry point anyway, so should be considered a new feature then.
Paths like UPDATE: On a second thought. There is currently |
I realised also that |
Do you have plans to support an ESM module output?
As
"module": "path/to/esm-file.js"
or viaexports
in package.json?I'd be happy to work on it and discuss the best approach to keep things maximum compatible or introduce a new major if needed.
The text was updated successfully, but these errors were encountered: