When the code was compiled, it was prompted that the'@ babel/runtime/core-js/object/keys' could not be found.

there is a file that compiles errors when using Object.keys (item), dynamic updates:

Error in Cannot find module "@babel/runtime/core-js/object/keys"
Error: Cannot find module "@babel/runtime/core-js/object/keys"

but I have already installed runtime, and the version has been changed to have object/keys.js

ps: is in the .uplohogrc.mock.js file


node_modules deleted and re-npm install to have a look!


for the time being, answer for yourself:
the reason for this error is that different versions of @ babel/runtime are introduced into the secondary dependencies of different plug-ins. There is no @ babel/runtime/core-js folder under the higher version 7.1.5. The directory of resolve when compiling in our dev environment is high version. Just specify a version of this file in the package.json of the project directory

.
 "@babel/runtime": "7.0.0-beta.46",
 
 

after looking at the babel documentation, runtime can be configured through plugins , or specified as @ babel/runtime-corejs2 , but it does not take effect after being set up by roadhog . I am not familiar with roadhog . If you don't want to do it, let's solve it this way

.
Menu