Skip to content

.ngfactory not found when upgrading @ngtools/webpack to >1.2.0 #4124

Closed

Description

@colltoaction

OS?

Windows 10

Versions.

node v6.9.4

Repro steps.

I have an app set up with @ngtools/webpack v1.2.0 and webpack v2.1.0-beta.27. When I try to upgrade to any of v1.2.1, v1.2.2, v1.2.3 or v1.2.4 (and also the required webpack version) I get the following error:

    ERROR in ./src/boot-client-aot.ts
    Module not found: Error: Can't resolve './components/main.aot.ngfactory' in 'XXXXX\src'
     @ ./src/boot-client-aot.ts 5:0-70

boot-client-aot.ts:

import "./polyfills";
import "./rxjs-operators";

import { enableProdMode } from '@angular/core';
import { platformBrowser } from "@angular/platform-browser";
import { MainModuleNgFactory } from "./components/main.aot.ngfactory";

enableProdMode();

// Boot the application, either now or when the DOM content is loaded
const platform = platformBrowser();
const bootApplication = () => { platform.bootstrapModuleFactory(MainModuleNgFactory); };
if (document.readyState === "complete") {
    bootApplication();
}
else {
    document.addEventListener("DOMContentLoaded", bootApplication);
}

Webpack config:

var ngToolsWebpack = require("@ngtools/webpack");
// ....
    plugins: [
        new ngToolsWebpack.AotPlugin({
            tsConfigPath: path.resolve(__dirname, "tsconfig.aot.json"),
            entryModule: path.resolve(__dirname, "ClientApp", "components", "main.aot#MainModule"),
        }),

It's worth noting that I tried different paths for the plugin configuration without success, including setting them through my tsconfig.aot.json.

Any help would be appreciated. Thanks!

Activity

  1. filipesilva commented on Jan 24, 2017

    @filipesilva
    Contributor

    @hansl any idea what's going wrong?

  2. colltoaction commented on Feb 4, 2017

    @colltoaction
    Author

    just tried v1.2.8 and it's still not working.

  3. wuzhouyang commented on Feb 9, 2017

    @wuzhouyang

    resolved ?

  4. colltoaction commented on Feb 9, 2017

    @colltoaction
    Author

    Sorry I'm not able to provide a repro at the moment. Are you having this same issue? Can you help with a repro?

    Thanks!

  5. wuzhouyang commented on Feb 9, 2017

    @wuzhouyang

    Sorry i just only used the @ngtool/webpack in my project. It's work in my repo but when i run my other project i got some error
    image

  6. colltoaction commented on Feb 13, 2017

    @colltoaction
    Author

    It seems to work if I use a simple main file and let the tools do their magic by convention like here: https://github.com/kunl/Angular-webpack-AOT/blob/master/src/main.ts

  7. filipesilva commented on May 22, 2017

    @filipesilva
    Contributor

    Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

    If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

  8. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions