问题
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