typesense-instantsearch-adapter icon indicating copy to clipboard operation
typesense-instantsearch-adapter copied to clipboard

Add option to bundle code manually

Open ArcoMul opened this issue 3 years ago • 5 comments

Description

I noticed that regenerator-runtime/runtime.js appears in our client-side JS bundle, which we don't need because we don't support IE11, and does add a significant amount of unnecessary JS. Would be great to have the option to bundle/compile the package ourselves so that our own bundle options can be used.

I'm by no means a npm package expert, so I might be wrong, maybe this is already possible in some way. Also not sure what the the solution would be, maybe if the src directory is also included when installing the package (by adding it to the files array in package.json) I could just include the files straight from that src directory? Or possibly the module option in package.json should be used which points to a version compiled without babel transformations.

Steps to reproduce

Expected Behavior

Actual Behavior

Metadata

typesense: 1.3.0-6

OS: Windows/Firefox

ArcoMul avatar May 04 '22 09:05 ArcoMul

@ArcoMul I'm also not an expert at npm packaging, but happy to include the src folder in the package if that helps. We already do this with the typesense-js lib (which has a Typescript source).

Could you clone this repo locally, use npm link and see if you're able to achieve what you have in mind by importing directly from src? If it does, I can then publish a new version with src included.

jasonbosco avatar May 04 '22 19:05 jasonbosco

Moving all typesense js packages to pure ESM is the real and modern solution to this, I believe. Angular for example gives warnings about CJS dependencies: https://angular.io/guide/build#configuring-commonjs-dependencies Here's a good blog about the why (also linked in the Angular guide): https://web.dev/commonjs-larger-bundles/

flevi29 avatar May 12 '22 12:05 flevi29

@jasonbosco I'm able to import TypesenseInstantSearchAdapter from the src folder, so including that folder would solve it in my case.

ArcoMul avatar May 16 '22 06:05 ArcoMul

@jasonbosco Would be great if you could release an update where the src folder is included? Would benefit us a lot! :-)

ArcoMul avatar May 30 '22 14:05 ArcoMul

@ArcoMul I've published 2.4.1 with the src directory included.

jasonbosco avatar May 30 '22 17:05 jasonbosco