You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build failure on gatsby App because of object.assign not resolve in node_modules/assert #61
Working on Gatsby app and suddenly getting this issue, causing build fail:
Generating development JavaScript bundle failed
Can't resolve 'object.assign/polyfill' in 'C:\Home\ARK\Repos\shape-website-3\shape-website\website\node_modules\assert'
If you're trying to use a package make sure that 'object.assign/polyfill' is installed. If you're trying to use a local file make sure that the path is correct.
im having the same issue. With 2.0.0 works fine. Im using npm and the assert package is a dependency of node-polyfill-webpack-plugin. If i add this to my package.json the build works fine:
Thanks for responding, and although it should resolve fine, it definitely doesn't for some of us. I'm kind of mystified why it doesn't, may be an issue with npm workspaces (I wouldn't be surprised at all) but I get the same error as OP, and directly editing the built file as I've outlined above fixes the issue.
Totally appreciate that you may not want to fix in this way as the object.assign library example is exactly how you've implemented it, but this fix does work and just wanted to add some detail, I'll probably just use patch-package to fix for now.
Activity
ljharb commentedon Sep 12, 2023
object.assign is in dependencies, so it’s fine on this end. Are you using npm?
CondeGil commentedon Sep 13, 2023
im having the same issue. With 2.0.0 works fine. Im using npm and the assert package is a dependency of node-polyfill-webpack-plugin. If i add this to my package.json the build works fine:
Without this i have the exact same issue as mention above
EDIT: Im using gatsby as well
ljharb commentedon Sep 13, 2023
Seems like it's an issue with that webpack plugin perhaps?
dburrows commentedon Nov 13, 2023
The issue seems to be resolving the polyfill file e.g. this line in
/build/assert.js:throws the resolution error, changing it to this:
fixes the issue, would be good to update the package
ljharb commentedon Nov 13, 2023
There should be no need, since that first line resolves just fine.
dburrows commentedon Nov 13, 2023
Thanks for responding, and although it should resolve fine, it definitely doesn't for some of us. I'm kind of mystified why it doesn't, may be an issue with npm workspaces (I wouldn't be surprised at all) but I get the same error as OP, and directly editing the built file as I've outlined above fixes the issue.
Totally appreciate that you may not want to fix in this way as the
object.assignlibrary example is exactly how you've implemented it, but this fix does work and just wanted to add some detail, I'll probably just usepatch-packageto fix for now.ljharb commentedon Nov 13, 2023
If it's just in gatsby, perhaps there's some hardcoded config there where it handles
object.assignbut not subpaths underneath it?