Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用angular4和webpack ngtools/webpack绑定手动延迟加载的模块_Angular_Typescript_Webpack_Aot - Fatal编程技术网

如何使用angular4和webpack ngtools/webpack绑定手动延迟加载的模块

如何使用angular4和webpack ngtools/webpack绑定手动延迟加载的模块,angular,typescript,webpack,aot,Angular,Typescript,Webpack,Aot,我在应用程序中有多个模块。我做了一些模块的延迟加载手动如下 this.moduleLoader.load('Infor.MinglePortal/tsScripts/usersettings/usersettings.module#UserSettingsModule') .then((moduleFactory: NgModuleFactory<any>) => { const vcRef = this.vcRef;

我在应用程序中有多个模块。我做了一些模块的延迟加载手动如下

 this.moduleLoader.load('Infor.MinglePortal/tsScripts/usersettings/usersettings.module#UserSettingsModule')
        .then((moduleFactory: NgModuleFactory<any>) => {
            const vcRef = this.vcRef;
            const ngModuleRef = moduleFactory.create(vcRef.parentInjector);
            const comp = ngModuleRef.injector.get(LazyLoadConfig).component;
            const compFactory = ngModuleRef.componentFactoryResolver.resolveComponentFactory(comp);
            this.compRef = vcRef.createComponent(compFactory, 0, ngModuleRef.injector);
            let info = {
                componentRef: this.compRef,
                factory: compFactory,
                moduleRef: ngModuleRef
            };


        });
}

webpack.config.js

enter code{
"compilerOptions": {
  "module": "es2015",
  "moduleResolution": "node",
  "target": "es5",
  "noImplicitAny": false,
  "sourceMap": true,
  "mapRoot": "",
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "lib": [
    "es2015",
    "dom"
  ],
  "outDir": "lib",
  "skipLibCheck": true,
  "baseUrl": ".",


},
"exclude":["./Abc.AbcPortal/tsScripts/abc-aot.ts", "./build/*", "./dist/*","node_modules"],
"angularCompilerOptions": {
  "debug": true,
  "entryModule":"./Infor.AbcPortal/tsScripts/abc/abc.module#abcModule"
}
const ngToolsWebpack = require("@ngtools/webpack");
const path = require("path");

module.exports = {
  resolve: {
    extensions: [".ts", ".js"]
  },
  node: {
    net: "empty",
    tls: "empty"
  },
  entry: "./abc.abcPortal/tsScripts/main.ts",
  output: {
    path: path.resolve(__dirname, "./build/"),
    publicPath: "/build/",
    filename: "[name].bundle.js",
    chunkFilename: "[id].chunk.js"
  },
  plugins: [
    new ngToolsWebpack.AotPlugin({
      tsConfigPath: "./tsconfig-web3.json"
    })
  ],
  module: {
    loaders: [
      { test: /\.css$/, loader: "raw-loader" },
      { test: /\.html$/, loader: "raw-loader" },
      { test: /\.ts$/, loader: ["@ngtools/webpack"] }
    ]
  }
我的问题是,我无法使用webpack+aot+ngtools/webpack加载延迟加载的模块

当我加载延迟加载的模块时,出现以下错误

main.bundle.js:2387错误:未捕获(承诺中):错误:找不到模块“abc.MinglePortal/tsScripts/usersettings/usersettings.module.ngfactory”。 错误:找不到模块“abc.MinglePortal/tsScripts/usersettings/usersettings.module.ngfactory”

请帮帮我