Open Miguelkode opened 7 years ago
Not exactly sure this is right but:
build_hooks.js (at the package level, not root. Mine's at @my-scope/myModule/build_hooks.js)
const globals = {
'rxjs/Observable': 'Observable'
};
module.exports.rollupFESM = function (config) {
if (config.external) {
config.external = config.external.concat(Object.keys(globals));
} else {
config.external = Object.keys(globals);
}
};
module.exports.rollupUMD = function (config) {
if (config.external) {
config.external = config.external.concat(Object.keys(globals));
} else {
config.external = Object.keys(globals);
}
config.globals = Object.assign(config.globals || {}, globals);
};
It seems to work for me so far. I'm using rxjs/Subject
and ng2-toastr/ToastModule
in mine and I've gotten them up and running.
Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass
We have a component, which uses "rxjs". We are trying to add this Angular library in the build_hooks.js file to construct the npm package using "npm run lib:build". But we obtain the next error:
Error: 'Observable' is not exported by node_modules/rxjs/Observable.js
We do not know if this the way to add this library. Can you help us?
Thank you so much.