gulp汇总不工作的外部资源导入 [英] gulp rollup not working external resource import
问题描述
我正在使用带有正确配置的babel的gulp-rollup插件。来自babel的传送代码需要加载babel-polyfill,所以我把
importbabel-polyfill;
位于我的主文件顶部(当然安装了babel-polyfill)。
不幸的是,gulp输出了这样的内容
'babel-polyfill' src / main.js,但无法解析 - 将其视为外部依赖项
在汇总调用中,我用
allowRealFiles:true
因此,rollup可以触及真正的文件系统。
不幸的是,在输出的代码中,没有填充代码。 >
如何解决它?
编辑:我添加并配置了rollup-plugin-commonjs,没有帮助
添加rollup-plugin-node-resolve解决了问题
汇总不是能够默认触摸npm注册表,并且需要插件才能完成它。
I'm using gulp-rollup plugin with properly configured babel. Transpiled code from babel needs babel-polyfill to be loaded so I put
import "babel-polyfill";
at the top of my main file (babel-polyfill is of course installed).
Unfortunatelly, gulp outputted something like this
'babel-polyfill' is imported by src/main.js, but could not be resolved – treating it as an external dependency
In rollup call, I used
allowRealFiles: true
So, rollup is able to touch real file system.
Unfortunately, in outputted code, no polyfill code is present.
How to fix it ?
EDIT: I added and configured rollup-plugin-commonjs, not helped
adding rollup-plugin-node-resolve resolved the problem
rollup is not able to touch npm registry by default and needs plugin to do it
这篇关于gulp汇总不工作的外部资源导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!