YardWill

Results 14 comments of YardWill

@cuiyongjian 赞同第一点,实际操作了一下,entry应该是按照目标浏览器的兼容性把所有需要的polyfill都放上去, 而usage就是上面提到的按照目标兼容性和按需原则引入,而当值为false的时候,就是不管三七二十一,把polyfill里面所有的内容都引入。 第二点的话,依我的理解一个完整和高兼容性的项目是需要babel-runtime和babel-polyfill一起支持的,babel-runtime提供runtimeHelper,babel-polyfill提供instance method。

包括拆分后的runtime-corejs2也不支持添加instance method。

``` const presets = [ [ '@babel/env', { targets: '> 0.25%, not dead', useBuiltIns: false, debug: true, modules: 'commonjs', }, ], ]; ``` 我尝试了一下仅用这个preset,然后在index内加上import '@babel/polyfill';使用async await 并没有报ReferenceError: regeneratorRuntime is not...

@creeperyang 你也可以看一看最后打包出来的文件,看一下有没有这句代码。我按照上面的配置是能搜索到的。 ``` __webpack_require__(/*! regenerator-runtime/runtime */ "./node_modules/regenerator-runtime/runtime.js"); ```

@creeperyang 多谢指教,不过我还有一个问题https://github.com/babel/babel/blob/master/packages/babel-preset-env/src/index.js#L286 为什么entry还需要自己引入polyfill? 以下是debug信息 1. 没有手动引入polyfill。 ``` Using polyfills with `entry` option: `import '@babel/polyfill'` was not found. ``` 2. 手动引入polyfill之后 ``` Using polyfills with `entry` option: Replaced `@babel/polyfill` with the...

其实docker是一个更好的解决方案,一旦打包完之后就可以直接push上去,服务器只需要pull就好了,还能配合k8s做动态扩容。

![image](https://user-images.githubusercontent.com/16497201/190935248-23c56127-e89f-4db6-8ce1-6da3b2069f45.png)

In decode module, maybe we can postMessage to node addon by IPC.