swissspidy / media-experiments

WordPress media experiments
GNU General Public License v2.0
87 stars 1 forks source link

Allow usage without CDN #292

Open swissspidy opened 10 months ago

swissspidy commented 10 months ago

Use mod_rewrite_rules filter to add .htaccess rules for setting COOP and COEP headers for the JS files.

Maybe add Site Health entry if not possible?

swissspidy commented 2 months ago

@kleisauke I hope you don't mind me pinging you here. I would appreciate your insight into getting wasm-vips to run in a web worker but without loading it from a CDN. In the past you helped me already with correctly setting locateFile and mainScriptUrlOrBlob. For reference, here is the current config:

https://github.com/swissspidy/media-experiments/blob/d51da5b3d6e6b25f5ae5746b36677741e80e914c/packages/vips/src/index.ts#L36-L50

Ideally I would not load wasm-vips from a CDN, so that I can use it even while offline.

The thing is, I don't know the site's URL at build/compilation time, but I can do things like dynamic imports (via webpack and relative URLs), setting __webpack_public_path__, or creating inline blobs for everything. In a WordPress context I'll also need to figure out setting the correct COEP/COOP headers for these files, but that's the least of my worries at the moment :)

kleisauke commented 2 months ago

@swissspidy No worries, wasm-vips is one of my pet projects. I just opened PR #603 for this.