gulp rollup not working external resource import

前提是你 提交于 2019-12-11 04:48:59

问题


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


回答1:


adding rollup-plugin-node-resolve resolved the problem

rollup is not able to touch npm registry by default and needs plugin to do it



来源:https://stackoverflow.com/questions/42401386/gulp-rollup-not-working-external-resource-import

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!