Skip to content

webpack AOT @ngtools throws error #3571

Closed

Description

@prithviraju1369

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')
        }),

Activity

  1. frederikschubert commented on Dec 15, 2016

    @frederikschubert

    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
    
  2. prithviraju1369 commented on Dec 15, 2016

    @prithviraju1369
    Author

    i uesed below webpack versions

    "webpack": "^1.13.0",
    "webpack-dev-server": "^1.14.1",
    "webpack-merge": "^0.14.0"

    will upgrading to your version work ?

  3. frederikschubert commented on Dec 15, 2016

    @frederikschubert

    Oh. I guess it is another error then. I don't know if upgrading would help you.

  4. hansl commented on Dec 15, 2016

    @hansl
    Contributor

    webpack 2.0 RC is unfortunately not supported at the moment. We are working with the webpack team to fix those errors, stay tuned for a christmas present. Just downgrade to the latest beta for the time being.

  5. prithviraju1369 commented on Dec 16, 2016

    @prithviraju1369
    Author

    this is not issue with webpack 2, it is with "webpack": "1.13.0",

  6. alexjajones commented on Dec 20, 2016

    @alexjajones

    I have also ran into this problem after trying to add AoT compiling to an existing Angular 2 project.

    Error

    0% compile 10% 0/1 build modules 70% 1/1 build modules/Users/user/Projects/angular-app/node_modules/@ngtools/webpack/src/plugin.js:175
                if (request.request.match(/\.ts$/)) {
                                   ^
    
    TypeError: Cannot read property 'match' of undefined
    

    Dependency versions

    "@angular/core": "2.2.3",
    "angular-cli": "1.0.0-beta.22-1",
    "@ngtools/webpack": "1.1.9",
    "webpack": "^1.13.1",
    

    Is there any additional information I can get you to help?

  7. hansl commented on Dec 21, 2016

    @hansl
    Contributor

    @prithviraju1369 Our peer dependencies are clearly indicating you need webpack 2 for this plugin.

  8. jpgcode commented on Dec 22, 2016

    @jpgcode

    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)
    
  9. prithviraju1369 commented on Dec 23, 2016

    @prithviraju1369
    Author

    @hansl does wepack 2 supports aot at this moment?

  10. kukjevov commented on Jan 4, 2017

    @kukjevov

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

  11. mlegenhausen commented on Jan 4, 2017

    @mlegenhausen

    Cause it is already fixed. See #3786. But there was no release until then.

  12. kukjevov commented on Jan 4, 2017

    @kukjevov

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

  13. marianocodes commented on Jan 7, 2017

    @marianocodes

    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?

  14. jusefb commented on Jan 12, 2017

    @jusefb

    Having the same problem using the following versions:

    "@ngtools/webpack": "1.2.1",
    "webpack": "2.2.0-rc.3"
    
  15. szykov commented on Jan 12, 2017

    @szykov

    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. (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'? 👍

  16. vascofernandes commented on Jan 12, 2017

    @vascofernandes

    same issue.

    "webpack": "^2.2.0-rc.4" and "@ngtools/webpack": "^1.2.1".

  17. Reuvenc commented on Jan 29, 2017

    @Reuvenc

    Is there anything new regarding this issue?
    I'm experiencing the same error with webpack 2.2.0 final, @ngtools/wepback 1.2.1.

  18. playmuser commented on Feb 1, 2017

    @playmuser

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

  19. angular-automatic-lock-bot commented on Sep 6, 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.

  20. locked and limited conversation to collaborators on Sep 6, 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions