I created a data library, then tried to include the data library into another created library. Built fine, but received - "No name was provided for external module 'my-data' in output.globals – guessing 'myData'". What am I missing?
Complete steps to re-create.
my-core.module.ts
import { NgModule } from '@angular/core';
import { MyCoreComponent } from './my-core.component';
import { MyDataModule } from 'my-data';
@NgModule({
declarations: [MyCoreComponent],
imports: [MyDataModule],
exports: [MyCoreComponent]
})
export class MyCoreModule { }
This is caused because you have an external dependency and you need to declare the name used so that the rollup knows what to look for when building the UMD bundle of my-core
.
To fix the warning declare your my-data
in ng-package.json
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/my-core",
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"my-data": "my-data"
}
}
}
I believe this is because since all dependencies are treated as external and your my-data
isn't installed through something like npm you need to declare the UMD module id that's expected. See https://github.com/ng-packagr/ng-packagr/blob/master/docs/dependencies.md#resolving-umd-module-identifiers