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

AOT compilation using ngtools/webpack #5907

Merged
merged 7 commits into from Jun 19, 2017
Merged

Conversation

sendilkumarn
Copy link
Member

@sendilkumarn sendilkumarn commented Jun 12, 2017

  • Please make sure the below checklist is followed for Pull Requests.

  • Travis tests are green

  • Tests are added where necessary

  • Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed

@sendilkumarn sendilkumarn changed the title aot AOT compilation using ngtools/webpack Jun 12, 2017
Copy link
Member

@deepu105 deepu105 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a minor mistake.

Dont forget to test prod profile in both maven and gradle

// AOT Plugin
new AotPlugin({
tsConfigPath: './tsconfig-aot.json',
entryModule: root('src/main/webapp/app/app.module#HipzeeAppModule')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoded module name!

comments: false,
sourcMap: true,
compress: {
screw_ie8: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😈

@sendilkumarn
Copy link
Member Author

sendilkumarn commented Jun 12, 2017

@deepu105 prod profile is working
what is that minor mistake expect module name

@deepu105
Copy link
Member

module name was the mistake i meant

-%>
import { platformBrowser } from '@angular/platform-browser';
import { ProdConfig } from './blocks/config/prod.config';
import { <%=angular2AppName%>AppModuleNgFactory } from '../../../../<%= BUILD_DIR %>aot/src/main/webapp/app/app.module.ngfactory';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be available all the time right?

@deepu105
Copy link
Member

check failed build

@@ -56,7 +56,7 @@ for (const idx in fields) {
tsType = 'string';
} else { //(fieldType === 'byte[]' || fieldType === 'ByteBuffer') && fieldTypeBlobContent == 'any' || (fieldType === 'byte[]' || fieldType === 'ByteBuffer') && fieldTypeBlobContent == 'image' || fieldType == 'LocalDate'
tsType = 'any';
if ((fieldType === 'byte[]' || fieldType === 'ByteBuffer') && fields[idx].fieldTypeBlobContent == 'image') {
if ((fieldType === 'byte[]' || fieldType === 'ByteBuffer') && fields[idx].fieldTypeBlobContent !== 'text') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, how this was not throwing error so far... 🤔

@deepu105
Copy link
Member

There is also issue with the TS entity model class which didnt fail earlier
Error at /home/deepu/workspace/temp/jh4test/target/aot/src/main/webapp/app/entities/product/product-dialog.component.ngfactory.ts:2434:45: Property 'subcategories' does not exist on type 'Product'.
When i changed public subcategory?: SubCategory, to public subcategories?: SubCategory[], it works

its coz of one to many relations declared in singular instead of plural as it appears in DTO or domain
so in _entity.model.ts line 65 to 76 needs to be altered. Now we need to check the relationship type and use proper plural form with type[] for DTO and no DTO cases. refer _entity.java and entityDTO.java

@deepu105
Copy link
Member

deepu105 commented Jun 14, 2017

try this fix

relationships.forEach(relationship => {
    let fieldType;
    let fieldName;
    const relationshipType = relationship.relationshipType;
    if (relationshipType == 'one-to-many' || relationshipType == 'many-to-many') {
        fieldType = `${relationships.otherEntityAngularName}[]`;
        fieldName = relationships.relationshipFieldNamePlural;
    } else {
        if (dto == "no") {
            fieldType = relationships.otherEntityAngularName;
            fieldName = relationships.relationshipFieldName;
        } else {
            fieldType = tsKeyType;
            fieldName = `${relationships.relationshipFieldName}Id`;
        }
    }
    variables[fieldName] = fieldName + '?: ' + fieldType;
});

could also convert the for loop on fields on same file to a forEach?

@deepu105
Copy link
Member

ok this fix lets it compile but still I get no screens. I see below error @sendilkumarn can you test it on a clean fresh project?


d66386d….main.bundle.js:1 ERROR Error: Uncaught (in promise): Error: No provider for CookieOptions!
Error: No provider for CookieOptions!
    at injectionError (d66386d….main.bundle.js:1)
    at noProviderError (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._throwOrNull (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._getByKeyDefault (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._getByKey (d66386d….main.bundle.js:1)
    at ReflectiveInjector_.get (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _CookieService_135] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _CSRFService_138] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _JhiTrackerService_139] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _Principal_140] (d66386d….main.bundle.js:1)
    at injectionError (d66386d….main.bundle.js:1)
    at noProviderError (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._throwOrNull (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._getByKeyDefault (d66386d….main.bundle.js:1)
    at ReflectiveInjector_._getByKey (d66386d….main.bundle.js:1)
    at ReflectiveInjector_.get (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _CookieService_135] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _CSRFService_138] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _JhiTrackerService_139] (d66386d….main.bundle.js:1)
    at Jh4TestAppModuleInjector.get [as _Principal_140] (d66386d….main.bundle.js:1)
    at resolvePromise (d66386d….polyfills.bundle.js:1)
    at resolvePromise (d66386d….polyfills.bundle.js:1)
    at d66386d….polyfills.bundle.js:1
    at ZoneDelegate.invokeTask (d66386d….polyfills.bundle.js:1)
    at Object.onInvokeTask (d66386d….main.bundle.js:1)
    at ZoneDelegate.invokeTask (d66386d….polyfills.bundle.js:1)
    at Zone.runTask (d66386d….polyfills.bundle.js:1)
    at drainMicroTaskQueue (d66386d….polyfills.bundle.js:1)
    at <anonymous>

} else {
fieldType = tsKeyType;
fieldName = relationships[idx].relationshipFieldName + "Id";
if (dto == "no") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh dto === 'no' plz i missed it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deepu105
Copy link
Member

protractor tests still failing probably same error as above when running in prod profile

@deepu105
Copy link
Member

btw also rebase with current master

@deepu105
Copy link
Member

@sendilkumarn are you stuck? do you need help? we really need this to proceed with #4794

new webpack.optimize.UglifyJsPlugin({
beautify: false,
comments: false,
sourcMap: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

@deepu105 deepu105 merged commit 1f81e96 into jhipster:master Jun 19, 2017
@deepu105
Copy link
Member

@sendilkumarn @jdubois I had to revert this PR as its causing some sort of infinite loop in ngc phase

@deepu105
Copy link
Member

I'll create a new branch and PR to work on this

@jdubois jdubois modified the milestone: 4.5.5 Jun 19, 2017
@sendilkumarn sendilkumarn deleted the aot2 branch October 21, 2020 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants