Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[core] Documentation of distribution formats #1618
Comments
Yes, those work both in Node and with older bundlers. Root cjs entry (
Yes, those files are used by modern bundlers like webpack@>=2, rollup etc. That suffix is just a convention - has no special meaning otherwise (unlike
Browser~ files are used by some bundlers by default when bundling for a browser (in example by webpack). Those are used in combination with alias fields, you can read a little bit more about them here. This allows us to prepare a slightly smaller build, destined for browsers, because we can assume the code in it will only ever get executed in browser and we can strip all the code which is just to handle Node.
Yes, I would say this is rarely used nowadays. |
|
@Andarist Thanks for the descriptions; perhaps this can be incorporated into the documentation somewhere! Now another question: When using core via a CDN in the browser with the |
This could be documented in http://preconstruct.tools/ - this is a tool which automates generating all of those for us. Would you be willing to prepare a PR for this? I don't believe we ship such file - the file you have mentioned is the closest but it has dependencies and a browser won't be able to resolve them until things like import maps land in browsers. |
|
Notes for anyone else who finds this issue:
@Andarist For the PR: you just want me to summarize your comment in https://github.com/emotion-js/emotion/edit/master/packages/core/README.md? |
|
Oh, so there is already documentation around this in preconstruct. That's cool. I would split this into 2 PRs:
|
|
@Andarist I still don't understand your meaning regarding the PR. You are much more familiar with this repo than I am, so I'm not sure what you're looking for without provision of:
|
|
As to preconstruct - I would edit this one: As to in emotion's docs - add FAQ top section in here + "Build types" item. Just follow how other sections are created there. I have never actually edited those files myself, but seems pretty easy - what you list under items maps to a file in that very same directory, doc files are written in mdx - you only need to add a frontmatter with a title on the top. |


I see this list of files:
core.browser.cjs.jscore.browser.esm.jscore.cjs.dev.jscore.cjs.jscore.cjs.prod.jscore.esm.jscore.umd.min.jsbut don't see any documentation.
I understand that the
cjsfiles are for CommonJS-stylerequire, and I am guessing that the.esm.jsfile is likemjs(forimporting), but what are the differences between thebrowserand non-browserreleases? Is theumdrelease for legacy environments without modules?