Skip to content
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

ngtools/webpack not work #4284

Closed
keyiis opened this issue Jan 30, 2017 · 10 comments · Fixed by #4301
Closed

ngtools/webpack not work #4284

keyiis opened this issue Jan 30, 2017 · 10 comments · Fixed by #4301

Comments

@keyiis
Copy link

keyiis commented Jan 30, 2017

Please provide us with the following information:

OS?

Windows10

Versions.

node 6.9.2

    "@angular/compiler-cli": "2.4.4",
    "@angular/platform-server": "2.4.4",
    "@ngtools/webpack": "1.2.4",
    "webpack": "^2.2.0",
    "webpack-dev-server": "^2.2.0",

Repro steps.

tsconfig.aot.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2015",
      "dom"
    ],
    "noEmit": true,
    "strictNullChecks": false,
    "skipDefaultLibCheck": true,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "node_modules/@types/",
      "typings/"
    ]
  },
  "angularCompilerOptions": {
    "skipMetadataEmit": true
  },
  "compileOnSave": false,
  "exclude": [
    "node_modules",
    "output"
  ]
}

webpack.aot.js

new AotPlugin({
                tsConfigPath: helpers.root('tsconfig.aot.json'),
                entryModule: helpers.rootAngular('app/app.module#AppModule'),
                skipCodeGeneration:true
            }),

The log given by the failure.

no error,but generate file size(app.js 6067kb) is same for aot and jit,so i think @ngtools/webpack not work?

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@filipesilva
Copy link
Contributor

skipCodeGeneration:true means you will not generate AoT code. Are you setting this to false for AoT runs?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Jan 30, 2017
@keyiis
Copy link
Author

keyiis commented Jan 30, 2017

@filipesilva if set skipCodeGeneration:false get below error

ERROR in ./src/angular/app/main.ts
Module not found: Error: Can't resolve './../../../$$_gendir/src/angular/app/app.module.ngfactory' in 'D:\work\nodejs\keypos\aot\src\angular\app'
 @ ./src/angular/app/main.ts 2:0-95

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve 'D:\work\nodejs\keypos\aot\$$_gendir' in 'D:\work\nodejs\keypos\aot\node_modules\@angular\core\src\linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 71:15-36 87:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/angular/app/main.ts

@filipesilva
Copy link
Contributor

That's a different problem though, and the real reason why you can't get size reductions. @hansl do you know the cause of that error?

@filipesilva filipesilva added type: RFC / discussion / question and removed needs: more info Reporter must clarify the issue labels Jan 30, 2017
@keyiis
Copy link
Author

keyiis commented Jan 30, 2017

@filipesilva the error means i need set "genDir":"some path" in "angularCompilerOptions"?
my project use template: require('./component.html'),if set skipCodeGeneration:false,i need change all template:require('...') to templateUrl:'....',has some simple way fix the problem?

@keyiis
Copy link
Author

keyiis commented Jan 30, 2017

@filipesilva @hansl after i change all template:require('...') to templateUrl:'....',the error disappears,but generate file size(4126KB after minify) big than use jit.

@keyiis
Copy link
Author

keyiis commented Jan 30, 2017

@filipesilva @hansl can give me some pointers?

@keyiis
Copy link
Author

keyiis commented Jan 31, 2017

@filipesilva @hansl still get big size bund file
11

@filipesilva
Copy link
Contributor

@keyiis you have to wait for a release to get the latest version. The PR fixing this has been merged but not released to npm yet.

@keyiis
Copy link
Author

keyiis commented Feb 6, 2017

@filipesilva i already update @ngtools/webpack & @angular/cli to last version,but aot still not work!

@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants