You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I built a test repo with some test commands that should verify if we're packaging nlx libs correctly.
I don't think we are.
Some issues:
package.json expects the main field to be a commonjs lib (fixed in unify rollup #119)
(not a umd / web problem) node checks either the file extension (.mjs -> esm, .cjs -> commonjs) or the type: field in package.json to figure out whether the dependency should use common js or esm packaging. I thought this blog post was helpful
Some solutions:
we rename the two files .mjs / .cjs
- pros: it works without a type field in package.json
- cons: apparently it's not supported by all build tools
we build two different package.jsons for js and esm
- pros: it should work for all builds tools
- cons: it's a bit more complicated
mixing default & named exports isn't properly supported by commonjs (or by our umd build)
let's resolve the second and third issue and
add the test-repo build scripts to CI
automate the browser packaging test and add it to CI as well (puppeteer?)
The text was updated successfully, but these errors were encountered:
michaelglass
changed the title
ensure esm, cjs, typescript builds as expected
ensure esm, cjs, typescript builds are usable
Jul 4, 2024
@jakub-nlx@michaelglass we have one user left on a legacy webpack build system, we expect them to be off within the next few months. After that, I would say that we should 'support cjs in a scrappy way', as in I would be comfortable telling users that if they really want cjs, they need to change the import path to @nlxai/chat-core/lib/index.cjs if they want to get to the compatible file.
I built a test repo with some test commands that should verify if we're packaging nlx libs correctly.
I don't think we are.
Some issues:
package.json expects the
main
field to be a commonjs lib (fixed in unify rollup #119)(not a umd / web problem) node checks either the file extension (.mjs -> esm, .cjs -> commonjs) or the
type
: field in package.json to figure out whether the dependency should use common js or esm packaging. I thought this blog post was helpfulSome solutions:
we rename the two files .mjs / .cjs
- pros: it works without a type field in package.json
- cons: apparently it's not supported by all build tools
we build two different package.jsons for js and esm
- pros: it should work for all builds tools
- cons: it's a bit more complicated
mixing default & named exports isn't properly supported by commonjs (or by our umd build)
let's resolve the second and third issue and
The text was updated successfully, but these errors were encountered: