-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'bind' of undefined #152
Comments
What browser(s) are you experiencing this error on? |
Chrome 85.0.4183.121. In Firefox 80.0.1 and 81.0.1, a quick Safari 14.0 similarly complains: |
Hmm, actually, I'm able to get it to work fine if I just use the pre-built file in a plain HTML file that isn't being touched by Webpack (as in webpack is not used on the page and is not loaded by any other dependencies). I suspect there's something unconventional happening with the way this library uses Webpack. Unfortunately I'm using a framework that doesn't provide any mechanisms for manipulating the webpack configuration: https://github.com/sanity-io/sanity |
is there any way for you to just copy in the penumbra files post webpack build? it's really as simple as that our webpack plugin looks like: plugins: [
// Copy in penumbra workers
new CopyPlugin({
patterns: [
{
from: `${PENUMBRA_DIRECTORY}/penumbra.worker.js`,
to: `${outputPath}/penumbra.worker.js`,
},
{
from: `${PENUMBRA_DIRECTORY}/penumbra.js`,
to: `${outputPath}/penumbra.js`,
},
],
}), where
and |
@michaelfarrell76 I would need to have a separate Webpack configuration to do anything, and I'm doubtful that would work in a plugin like I'm trying to build. For context, today there is no way to securely upload files to the Sanity.io service via the open source Studio CMS. I'm working on a plugin for the Studio that that will encrypt files prior to upload (access to the uploaded assets is public) and store the generated key in the Studio dataset (access to which is authenticated). As a result, I'm fairly constrained in terms of the configuration. I'm spiking on doing this in an iframe and using |
let us know if you find out anything more! a bit tricky for us to help without having control over the webpack compilation but happy to address any questions you may have |
I haven't run into this before, so I'm kind of unsure why any Webpack configuration is required. Is there something in particular that Penumbra does that means it isn't possible to build it in a way that it can be imported and used like any other package? The statically built library contains references to webpack that conflict which isn't something I would expect. |
@coreyward The reason that importing penumbra is a little more involved than other packages is because we include a required web worker module. This web worker module is not currently inlined into our entry bundle. It should be possible to inline the web worker module so that it can be loaded from a Blob URI generated at runtime from minified JS source. I've filed an issue for this feature: #153 |
@eli Thanks for the context! That sounds like a great improvement. Any idea what sort of rough ETA we might be looking at for something like that? |
@coreyward Also your specific error appears to be related to I noticed this in our generated code from Webpack: As for an ETA for inlining the penumbra worker script, I can't give any hard figures at this time as it is not my current priority. Once I start working on it, it will probably take a few days (<5) to complete. |
Ohhh yeah it looks like Sanity is still using Webpack 3, where |
Yes! We're actually starting that work now, and I believe we're going right to 5. |
hey @coreyward @kmelve is this still an issue for you all? |
I think there's something wrong with the build or the instructions (maybe a dependency?). I tried to use this, but no matter what I tried I got the above error. Even just doing
import { penumbra } from '@transcend-io/penumbra';
in a webpack/React app or adding the pre-builtbuild/penumbra.js
to an HTML page a results in the error.The text was updated successfully, but these errors were encountered: