-
Notifications
You must be signed in to change notification settings - Fork 163
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
Deno/ESM support #94
Comments
That is what I had to do too to get it loading using plain |
Yes please! A build like ... at fuse.js .... to target different module patterns would be nice. Otherwise just go for esm? As this is and will be the way to go anyway on any js runtime. |
i tried for days to understand how to properly distribute a js library but i can't figure it out without making a mess. it seems like Deno works now though. they can just import a UMD module (as long as it's hosted on npm, i couldn't get it to import a local file successfully but i guess that's fine) is an ESM build still needed? i don't like the complexity of multiple builds. |
ESM support is greatly appreciated. Loading fuzzysort via UMD is sometimes unreliable, especially when it collides with the Monaco Editor loader. Because of this, I published an ESM fork of fuzzysort. However, if you are interested in providing an ESM build upstream, I would gladly contribute. |
Hello, I woud be interested in this too. I'm using tsup to package my packages to provide both (I'm using it with typescript project but I think it can support JS to) |
+1 for native ESM support. We use Angular 17 and Typescript in our project and during compilation there's a waning message mentioning that CommonJS dependencies might increase bundle size and prevent optimisation: https://v17.angular.io/guide/build#configuring-commonjs-dependencies |
I think the consensus is ESM moving forward.
I was also in this situation when I published my first OS package where I wanted to dual emit CJS/ESM + UMD builds just for the sake of compatibility. I poured tons of hours trying to get it right (as well as the types) and I eventually settled with Rollup. It's simpler than you might think. You can just write the code in any fashion, make sure it has at least one public export, and just let the build tool do the bundling work for you. Here's my config for example in case you're interested. Also, I do my type checks with Are the types wrong?. |
Fixes farzher#94 Adds a rollup config file to build ESM, CJS, and UMD bundles. Based on the source in src/fuzzysort.js. Checks in the new esm file and the updated cjs and umd files. Also updates the package.json to include `module` and `browser` fields for the ESM and UMD bundles.
Fixes farzher#94 Adds a rollup config file to build ESM, CJS, and UMD bundles. Based on the source in src/fuzzysort.js. Checks in the new esm file and the updated cjs and umd files. Also updates the package.json to include `module` and `browser` fields for the ESM and UMD bundles.
Fixes farzher#94 Adds a rollup config file to build ESM, CJS, and UMD bundles. Based on the source in src/fuzzysort.js. Checks in the new esm file and the updated cjs and umd files. Also updates the package.json to include `module` and `browser` fields for the ESM and UMD bundles.
Fixes farzher#94 Adds a rollup config file to build ESM, CJS, and UMD bundles. Based on the source in src/fuzzysort.js. Checks in the new esm file and the updated cjs and umd files. Also updates the package.json to include `module` and `browser` fields for the ESM and UMD bundles.
This is gonna be a quick one: I'm using Deno (version 1.19.2), and couldn't import the
fuzzysort.js
file as a module. One quick hack with the file (and by that, I mean I removed the UMD function, and added anexport const fuzzysort
declaration ) later, and it looked like the problem was (somewhat) resolved.Of course, the hack I did was complete crap - But it could be a step in the right direction. Is proper support for ESM imports a possibility? Or is there something I'm missing, here?
The text was updated successfully, but these errors were encountered: