-
Notifications
You must be signed in to change notification settings - Fork 12k
--aot fails to build with no entryModule error #2887
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
Comments
Ran into the same issue. With the current configuration, auto discovery takes precedence over tsconfig. |
Did some more debugging on this and found that the issue is around the parsing of the
|
Have you found a solution/work-around? I'm experiencing a similar issue which is likely caused by a custom function wrapping the |
It would seem that the only the top-level of the |
I have a similar setup that leads to this error: import './polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/';
import { AppSettings } from './app/app.settings';
if (environment.production) {
enableProdMode();
}
declare var fetch: any;
fetch('config.json', {method: 'get'}).then(res => {
res.json().then(settings => {
AppSettings.settings = settings;
platformBrowserDynamic().bootstrapModule(AppModule);
});
}); |
When can we expect a fix for that to be available through NPM?. For now I manually changed the file as @uitgewis suggested. |
Even I am waiting for the fix through npm. Please update once it is available. |
I get this same error. If I remove the catch handler it works. platformBrowserDynamic().bootstrapModule(AppModule);/*.catch(err => {
console.error(err);
});*/ |
Apparently.. // works
platformBrowserDynamic().bootstrapModule(AppModule);
// works
var promise = platformBrowserDynamic().bootstrapModule(AppModule);
promise.then(() => console.log('test'));
// doesn't work
platformBrowserDynamic().bootstrapModule(AppModule).then(() => console.log('test')); |
I got this error wen I use polymer with angular cli . to use that I had to creat
and
and in I have to set How I'm gone workaround this problem |
Also breaks a hybrid app (angular 1 and 2) using the upgradeAdapter to bootstrap: upgradeAdapter.bootstrap(document.body, ['app']); |
@rumes, in what directory did you place the main-polymer.ts file you created? |
@Chris-Vere /src |
i used @juristr 's suggestion and it worked! Thanks, |
I have the same config that @rumes and it is working fine with angular-cli: 1.0.0-beta.21, but breaking in 1.0.0-beta.22-1. |
I'm not certain this is related to the original problem, but I encountered this same error in beta.22-1 when attempting to move my app component files from the angular-cli default of I tracked the problem to I changed export * from './app.component';
export * from './app.module'; To this: export * from './containers/app/app.component';
export * from './app.module'; Is it possible that other reports have also placed their entry component in a location that is not exported in the same barrel as |
Correction: nixing the first line in |
I have a similar setup to @binarious. The only solution that seems to work for that scenario is the suggestion by @uitgewis to change https://github.com/angular/angular-cli/blob/master/packages/%40ngtools/webpack/src/entry_resolver.ts#L133 to pass true instead of false. |
This package isnt public or stable yet, so no documentation. Also included fixes for: - Fixes angular#2887.
Recently I upgraded my angular-cli to the latest version to this date. I ran into the same error as OP while creating a migration-project. The project failed to install all the right dependencies and then I tried to start the server by angular-cli anyhow. Resolution Update
|
@kevto rerun |
I have the same issue without using --aot. Only with And the most strange thing is that in my laptop is working, but not in the server, with the same angular-cli version! 😨 My laptop (working)
My server (not work)
|
Ok, my fault!! app directory was in the .gitignore and this is the reason why the server fails doing |
My workaround for now: // my original code
window.setTimeout(() => {
platformBrowserDynamic().bootstrapModule(AppModule);
}, 0);
// added workaround
if (false) {
platformBrowserDynamic().bootstrapModule(AppModule);
} |
This package isnt public or stable yet, so no documentation. Also included fixes for: - Fixes angular#2887.
i had this problem when move files in webstorm, it refacted with extension and this is the problem. to: |
This package isnt public or stable yet, so no documentation. Also included fixes for: - Fixes angular#2887.
I was in process of upgrading an app that previously used [email protected] and came across same exact error message, however, this happens when I try to run AoT version, i.e. with platformBrowser, not platformBrowserDynamic.
I have not been working in direct Angular web app for several months, am I missing something? |
kinggolf |
@panglisen @hansl @juristr |
Just FYI: in the latest v1.0.0-beta.25 (and possibly earlier as well, but then the search was not recursive flag yet; #3708), the same error will show if more than 1 item is found. In our case, we use conditional bootstrapping of multiple modules (a quite hacky way to implement widgets until a verdict is known for Angular angular/angular#13035), something like the nasty:
To show how many items were found, adjust @ngtools/webpack/src/entry_resolver:
Also note that output from that |
@panglisen In case this you still have an open issue, here is my take now. Apparently I have been out of loop for quite a while on angular-cli. It seems my flow in above comment is no longer appropriate. I think steps 4-8 can be dropped and simply run |
I can confirm for me issue is now resolved on the latest beta 25. |
@johnchristopherjones just in case you did not know: as for (no longer) using the "barrel" |
I have this issue using polymer with vaadin and angular2, if I create main-polymer.ts and change the angular-cli.json to start from this file I have the error: "Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options." |
I had the same issue when I wanted either to wait for Changing the
It seems like there may only be a single call to |
It seems everybody got this to work when calling bootstrap without wrapping it. We don't wrap and still run into this issue. This is our // import ...
if (environment.production) {
enableProdMode();
}
const options: ToastOptions = new ToastOptions({
toastLife: 15000,
positionClass: 'toast-top-center',
showCloseButton: true
});
@NgModule({
imports : [BrowserModule, FormsModule, HttpModule, routing, ToastModule.forRoot(options)],
declarations: [AppComponent, COMPONENTS, ARTICLE_DND_DIRECTIVES],
providers : [appRouterProviders, SERVICES, ARTICLE_DND_PROVIDERS, WindowRefService,
{provide: ErrorHandler, useClass: CustomErrorHandler}, DatePipe],
bootstrap : [AppComponent]
})
export class AppModule {
}
platformBrowserDynamic().bootstrapModule(AppModule); And we get
using Angular CLI version 1.0.0-beta.28.3 |
Ok I just solved it. I cannot declare the |
I have been facing the same issue when I have tried to load Module according to if statement.
This code could not compile with message:
To fix this error I have made another typescript file (just as @LukasBombach explained):
and now main.ts look like this:
I can compile without any problems now.
|
@criticalbh, nice workaround! However, am I right to assume that If true, then I guess that specifying that module as the entry module in
(The above solves things for me, but requires the entry module to hit all code that other modules need. In our case, |
I'm having same issue, it started when I enabled HMR feature in the Angular-cli and the BootstrapModule is not wrapped under any DOM element, my main.ts below:
any idea how to resolve this issue without revert back HRM? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
osX El Capitan
Versions.
Repro steps.
When trying to use
--aot
on an app without the standard app.module.ts pattern the build fails with the below error. As per the documentation tried adding the following to the tsconfig and that did not resolve the issue.The log given by the failure.
The text was updated successfully, but these errors were encountered: