添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Error: Can’t resolve ‘babel-runtime/core-js/promise’

problem

启动项目,项目中用到了 Promise,页面和控制台报错
Error: Can’t resolve ‘babel-runtime/core-js/promise’

reason

依赖包问题

solution

pnpm install --save babel-runtime

SetInterval报错: Error : Can't resolve 'timers' webpack < 5 used to include polyfills for node. js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. 很多坑都是由于版本变化所产生的,我学习的时候看的教程是webpack3的,但是在练习的时候使用的是webpack4,所以把遇到的坑和解决方法整理在这里。 1. babel -loder版本问题及相关报错 报错 Error : Cannot find module ‘@ babel / core babel -loder是需要安装对应的 babel - core 版本的, babel -loader 8 对应的 babe... ERROR in ./node_modules/ babel -loader/lib!./node_modules/vue-loader/lib/selector. js ?type=script&index=0!./src/App.vue Module not fo... 由于有些浏览器版本的发布是在 es6 定稿和发布之前的,因此对于老版本的浏览器是没有对 es6 的特性进行兼容的,针对 es6 的兼容问题,许多团队也做出了相应的 开发 ,将 es6 的语法转换成针对浏览器可以识别的 es5 语法,充当一个翻译官的角色;比较通用的工具有: babel js x、traceur、es6-shim 等。 一上车就遇到的梗!!! 开发 中,不管你是大佬还是小菜,一定会晕倒ES6的兼容问题,因为现在ES6用的比较潮流的。下面来总结一下不同环境下有关ES6的相关兼容。 具体ES6兼容解决方案:. X [ ERROR ] Could not resolve "@ babel / runtime /helpers/classCallCheck" node_modules/.pnpm/@antv+g-webgpu-engine@https+++registry.npmmirror.com+@antv+g-webgpu-engine+-+g-webgpu-engine-0.5.6.tgz/node_modules/@antv/g-webgpu-engine/es/webgpu/WebG PUModel. js : 此篇来解决上篇提出的问题,官方给出 babel -polyfill 和 babel - runtime 两种解决方案来解决这种全局对象或全局对象方法不足的问题 1. babel -polyfill babel -polyfill 会在应用中模拟一个 es2015+ 的环境,对新语法需要的新对象进行补全 使用 babel -polyfill 后,可以使用内置对象如 Promise 、WeakMap,静... promise 是异步编程的一种解决方案,比传统的解决方案——回调函数和事件监听——更合理和强大 promise 可以理解为一个容器,里面保存着某个未来才会结束的事件的结果。 promise 是一个对象,从他可以获取异步操作的消息。 promise 提供统一的api,各种异步操作都可以用同样的方法进行处理 × 「wdm」: assets by status 15.1 KiB [cached] 3 assets asset index. js 895 KiB [emitted] (name: main) cached modules 330 KiB [c These dependencies were not found: * babel - runtime / core - js / js on/stringify in ./src/mock/modules/sys-menu. js , ./src/ router/index. js and 1 other * babel - runtime / core - js /object/ke...