-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build errors due to undefined namespaces #6
Comments
Finally, can you please let me know where Thanks again for your work! |
Update - this is my updated code after finding the example here import { BrowserModule } from '@angular/platform-browser';
import { DoBootstrap, Injector, NgModule } from '@angular/core';
import {
HelloWorldComponent,
NgHelloWorldModule,
} from '@ah-applications-nx/ng/hello-world';
import { createCustomElement } from '@angular/elements';
import { createNg1Wrapper } from 'create-ng1-wrapper';
import * as angular from 'angular';
@NgModule({
imports: [BrowserModule, NgHelloWorldModule],
providers: [],
})
export class AppModule implements DoBootstrap {
constructor(private injector: Injector) {
const elements: any[] = [[HelloWorldComponent, 'hello-world-ce']];
const dcWebComponentsModule = angular.module('ng1WebComponents', []);
for (const [component, name] of elements) {
const el = createCustomElement(component, { injector });
customElements.define(name, el);
const ng1El = createNg1Wrapper(name, component, { injector });
dcWebComponentsModule.component(
`${this.toCamelCase(name)}Wrapper`,
ng1El
);
}
}
ngDoBootstrap() {}
private toCamelCase(s: string) {
return s.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
}
} import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HelloWorldComponent } from './hello-world/hello-world.component';
@NgModule({
imports: [CommonModule],
declarations: [HelloWorldComponent],
exports: [HelloWorldComponent],
})
export class NgHelloWorldModule {} |
Another update - the build errors go away with npm i -D @types/angular IMO this package should be added as a peer dependency along with angular since this plugin cannot work without them. Then, I got a new error
This error seems similar to the following post https://www.amadousall.com/angular-cli-module-not-found-error-cant-resolve/ Perhaps browser needs to be defined as a Or, a module might be declared in multiple modules angular/angular-cli#8860 |
Thanks for creating this wrapper!! It looks like I'm getting a number of errors due to different namespaces being assumed as defined but as we can see that doesn't seem to be the case for me. I'm on Angular 11 so maybe this lib needs an update to work with that version?
If I'm missing something about how to use the library, let me know! Documentation is a little sparse as noted #5
Here's my
package.json
For additional context, here's how I'm trying to use the package
The text was updated successfully, but these errors were encountered: