Subresource integrity error
We've been using this library for a while but are having problems with the v0.8+ releases. In addition to not exporting most of the types (see https://github.com/nextapps-de/flexsearch/issues/342#issuecomment-2772370334), it appears that Vite is using a different version of this package when building for production vs. local development. This results in the following error when using a content security policy to whitelist the various script-src:
localhost/:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://localhost:4173/assets/index-F5PzREtn.js' with computed SHA-256 integrity 'mAt2XXcJ08sos08Ul/Wi7XhLDYG/F2SRpvgwa+brcN0='. The resource has been blocked.
I believe this has to do with the build system overhaul explained in https://github.com/nextapps-de/flexsearch?tab=readme-ov-file#load-library-nodejs-esm-legacy-browser, though as Typescript users we don't have a choice other than import { Document } from 'flexsearch';.
Hey @niksauer the latest update export every type. Is it solving your issue?
There don't seem to be any new releases. How can I test a beta build?
@niksauer there is a new release on NPM
It somewhat helps with the types but things like Id or Tokenizer are still not exported. Regardless, exporting types won't fix this subresource integrity error. That's related to the bundle(s) being distributed. Merely importing flexsearch in our apps makes it break.
@niksauer The index.d.ts now exports everything. There is a testfile for Typescript located here: https://github.com/nextapps-de/flexsearch/blob/master/test/types.ts
Compiling those file works fine by tsc ./types.ts.