react-inline-auto-prefixer icon indicating copy to clipboard operation
react-inline-auto-prefixer copied to clipboard

Cannot resolve module 'babel-runtime/core-js/object/keys'

Open bvaughn opened this issue 9 years ago • 4 comments

Seeing the following error after installing react-inline-auto-prefixer:

Module not found: Error: Cannot resolve module 'babel-runtime/core-js/object/keys' in /path/to/project/node_modules/auto-prefixer/dist

This is because the dist is requiring babel-runtime/core-js/object/keys and babel-runtime/core-js/object/assign directly rather than relying on the user to polyfill Object.keys and Object.values. Any reason for this?

bvaughn avatar Jan 09 '16 20:01 bvaughn

Not sure what you mean, how could the user be responsible for that?

yonatanmn avatar Jan 12 '16 18:01 yonatanmn

I'm not sure what the best way would be, but one way would be to check for the existence of Object.keys or Object.values and only require the babel-runtime polyfill if they don't exist. This way projects that use an alternate polyfill approach don't get a runtime error.

Object.keys for example is pretty widely supported at least in the browser world.

bvaughn avatar Jan 12 '16 19:01 bvaughn

The point of this rep is to give old browsers compatibility, so I won't rely on native support. But supplying external polyfills after native check is good Idea. would you like to provide a PR? The fist thing to do is to remove runtime from .babelrc, and then adding those polyfills (from MDN's site or somewhere else)

yonatanmn avatar Jan 14 '16 13:01 yonatanmn

I'm having the same issue and seems it depends on OS:

ERROR in ./~/auto-prefixer/dist/react-inline-auto-prefixer.js
Module not found: Error: Cannot resolve module 'babel-runtime/core-js/object/assign' in /home/ubuntu/trigger_mail/node_modules/auto-prefixer/dist
 @ ./~/auto-prefixer/dist/react-inline-auto-prefixer.js 3:21-67

On OS X everything works fine

pavelvlasov avatar Feb 19 '16 20:02 pavelvlasov