angular-cli: webpack AOT @ngtools throws error

While doing AOT bundle Results below error at file path

d:\xyz\angular2-lazyr\node_modules@ngtools\webpack\src\plugin.js:167 if (request.request.match(/.ts$/)) { ^

// Virtual file system.
        compiler.resolvers.normal.plugin('resolve', function (request, cb) {
            if (request.request.match(/\.ts$/)) {
                _this.done.then(function () { return cb(); });
            }
            else {
                cb();
            }
        });

Below is AOT webpack config


plugins: require('./../webpack/plugins').concat([
        new ngtools.AotPlugin({
            tsConfigPath: helpers.root('tsconfig.aot.json'),
            entryModule: helpers.root('src/app/app.module#AppModule')
        }),

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Having the same issue using webpack 2.2.0-rc.1

TypeError: Cannot read property 'plugin' of null
at AotPlugin.apply (.../node_modules/@ngtools/webpack/src/plugin.js:210:34)

This is with webpack@2.2.0-rc.0 and here is the stack trace:

/Users/frederik/someProject/node_modules/@ngtools/webpack/src/plugin.js:174
        compiler.resolvers.normal.plugin('resolve', function (request, cb) {
                                 ^
TypeError: Cannot read property 'plugin' of null
    at AotPlugin.apply (/Users/frederik/someProject/node_modules/@ngtools/webpack/src/plugin.js:174:34)
    at Compiler.apply (/Users/frederik/someProject/node_modules/tapable/lib/Tapable.js:270:16)
    at WebpackOptionsApply.process (/Users/frederik/someProject/node_modules/webpack/lib/WebpackOptionsApply.js:61:18)
    at webpack (/Users/frederik/someProject/node_modules/webpack/lib/webpack.js:32:48)
    at /Users/frederik/someProject/src/tasks/build.task.ts:21:9
    at runBuild (/Users/frederik/someProject/src/tasks/build.task.ts:20:12)
    at Object.default_1 [as default] (/Users/frederik/someProject/src/tasks/build.task.ts:15:12)
    at Object.main (/Users/frederik/someProject/src/cli.ts:41:37)
    at Object.<anonymous> (/Users/frederik/someProject/src/cli-entry.ts:13:5)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Same error with with webpack 2.2.0 final, @ngtools/wepback 1.2.1.

TypeError: Cannot read property ‘plugin’ of null at AotPlugin.apply (C:\Users\User\Desktop\ng2-cv-blog\src\node_modules@ngtools\webpack\src\plugin.js:210:34) at Compiler.apply (C:\Users\User\Desktop\ng2-cv-blog\src\node_modules\tapable\lib\Tapable.js:270:16) at webpack (C:\Users\User\Desktop\ng2-cv-blog\src\node_modules\webpack\lib\webpack.js:32:19) at processOptions (C:\Users\User\Desktop\ng2-cv-blog\src\node_modules\webpack\bin\webpack.js:303:14) at Object.<anonymous> (C:\Users\User\Desktop\ng2-cv-blog\src\node_modules\webpack\bin\webpack.js:362:1) at Module._compile (module.js:571:32) at Object.Module._extensions…js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:420:7) at startup (bootstrap_node.js:139:9) at bootstrap_node.js:535:3 Process terminated with code 1.

Same thing for “webpack”: “^2.2.0-rc.4” and “@ngtools/webpack”: “^1.2.1”.

When we can expect our ‘christmas present’? 👍

Having the same problem using the following versions:

"@ngtools/webpack": "1.2.1",
"webpack": "2.2.0-rc.3"

I’m getting the same issue with Webpack R.C.3. As a temporally solution I cloned the angular-cli repo and ran a local build then copied @ng-tools and pasted on my node_modules folder, that fixed the problem. But I was expecting to see a smaller size of the app.js and actually it is heavier. Is this ok?

Thank you for your answer. Any possible date for new release 😃?

Having same problem as @jpgcode with Webpack 2.2.0-rc.3, why is this closed?

this is not issue with webpack 2, it is with “webpack”: “1.13.0”,