Skip to content

webpack AOT @ngtools throws error #3571

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

Closed
prithviraju1369 opened this issue Dec 15, 2016 · 19 comments
Closed

webpack AOT @ngtools throws error #3571

prithviraju1369 opened this issue Dec 15, 2016 · 19 comments

Comments

@prithviraju1369
Copy link

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')
        }),
@frederikschubert
Copy link

This is with [email protected] 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

@prithviraju1369
Copy link
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 ?

@frederikschubert
Copy link

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

@hansl
Copy link
Contributor

hansl commented Dec 15, 2016

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.

@hansl hansl closed this as completed Dec 15, 2016
@prithviraju1369
Copy link
Author

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

@alexjajones
Copy link

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?

@hansl
Copy link
Contributor

hansl commented Dec 21, 2016

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

@jpgcode
Copy link

jpgcode commented Dec 22, 2016

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)

@prithviraju1369
Copy link
Author

@hansl does wepack 2 supports aot at this moment?

@kukjevov
Copy link

kukjevov commented Jan 4, 2017

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

@mlegenhausen
Copy link

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

@kukjevov
Copy link

kukjevov commented Jan 4, 2017

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

@marianocodes
Copy link

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?

@jusefb
Copy link

jusefb commented Jan 12, 2017

Having the same problem using the following versions:

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

@szykov
Copy link

szykov commented Jan 12, 2017

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

@vascofernandes
Copy link

same issue.

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

@Reuvenc
Copy link

Reuvenc commented Jan 29, 2017

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

@playmuser
Copy link

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests