-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
ComputeKit seems to have a problem when you build for production (more specifically, when names are obfuscated), and you have third party dependencies that are not functions defined in your app. e.g. remoteDependencies: ["https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.18/dayjs.min.js",]
I have something like this:
const workerUtilsCode = `
self.${myFirstFunction.name} = ${myFirstFunction.toString()};
self.${mySecondFunction.name} = ${mySecondFunction.toString()};
self.${myThirdFunction.name} = ${myThirdFunction.toString()};
`
const blob = new Blob([workerUtilsCode], { type: 'application/javascript' });
const workerUtilsUrl = URL.createObjectURL(blob);export const kit = new ComputeKit({
remoteDependencies: [
"https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.18/dayjs.min.js",
workerUtilsUrl,
]
})
.register("foo", () => {... dayjs() ...}) // Say `dayjs` gets the obfuscated name `Ke` then you can expect this error in a production build `[ComputeKit:Pool:error] Task ml8ld29e-9bc6fxcwj failed: Ke is not defined´Note that it is important to do self.${myFirstFunction.name} so that for a production build, the obfuscated name is used. This works for the functions I defined in my app. I think computeKit lacks self.${xxxxxxx.name} logic for when it loads in third party dependencies.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels