forked from external-repos/squoosh
Remove decorators and bundler workarounds
This commit is contained in:
13
src/index.ts
13
src/index.ts
@@ -1,18 +1,7 @@
|
||||
declare module '@webcomponents/custom-elements';
|
||||
|
||||
// Patch Worker to ignore `importScripts("x.css")` generated by Parcel:
|
||||
const W = self.Worker;
|
||||
self.Worker = function (url: string | URL, options?: WorkerOptions) {
|
||||
const code = `
|
||||
importScripts=(function(){
|
||||
return this.apply(self,[].slice.call(arguments).map(function(x){return !/\\.css$/i.test(x) && new URL(x,self.url).href}).filter(Boolean))
|
||||
}).bind(importScripts);importScripts(self.url=${JSON.stringify(url)})
|
||||
`.trim();
|
||||
return new W(URL.createObjectURL(new Blob([code], { type: 'text/javascript' })), options);
|
||||
} as any as (typeof Worker);
|
||||
|
||||
function init() {
|
||||
require('./init-app.tsx');
|
||||
import('./init-app.tsx');
|
||||
}
|
||||
|
||||
if (!('customElements' in self)) {
|
||||
|
||||
Reference in New Issue
Block a user