Skip to content

Angular Cli 1.0.0-beta.11-webpack.8: ng build failed if route 'loadChildren' #1891

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
cuiliang opened this issue Aug 30, 2016 · 9 comments · Fixed by #1987
Closed

Angular Cli 1.0.0-beta.11-webpack.8: ng build failed if route 'loadChildren' #1891

cuiliang opened this issue Aug 30, 2016 · 9 comments · Fixed by #1987

Comments

@cuiliang
Copy link

https://github.com/angular/angular-cli/blob/master/addon/ng2/models/find-lazy-modules.ts#L38

.map((node: ts.PropertyAssignment) => {
        return JSON.parse(node.initializer.getText(source)); // tslint:disable-line
      });

JSON.parse failed with :

loadChildren:'app/+workspace/+settings/settings.module#SettingsModule'
@mjolk
Copy link

mjolk commented Aug 30, 2016

"Unexpected token ' in JSON at position 0". :)

@LibertyBeta
Copy link

LibertyBeta commented Aug 30, 2016

Can confirm and reproduce. Moving to ` removes the error, but causes routing to fail.

@monojack
Copy link
Contributor

Do lazy modules work with a system.js build?

@cuiliang
Copy link
Author

@monojack yes, works before update to angular-cli@webpack

@rosslavery
Copy link

Can confirm I'm getting the same thing using:

angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: win32 x64

@shaunlmason
Copy link

Same same.

angular-cli: 1.0.0-beta.11-webpack.8
node: 6.4.0
os: win32 x64

@coryrylan
Copy link
Contributor

I believe the latest webpack branch ( beta.11-webpack.8 ) does not currently support lazy loaded modules yet.

@shaunlmason
Copy link

shaunlmason commented Sep 1, 2016

I believe the latest webpack branch ( beta.11-webpack.8 ) does not currently support lazy loaded modules yet.

You are correct in a way. RC5 apparently uses System.js to do the lazy loading, since the CLI moved to Webpack that method is unavailable. It looks like the RC2 router and RC6 resolve the issue. Unfortunately for me, the Angular 2 Material team is a bit out of sync, so I can't upgrade to RC6 yet.

I worked around it and implemented a basic async module loader for the time being.

hansl added a commit to hansl/angular-cli that referenced this issue Sep 5, 2016
and properly understand and return the modules in this case.

Also refactored that function to be clearer, and added a test to cover.
I made sure the test was failing before this PR ;)

Fixes angular#1891, angular#1960.

cc @filipesilva @ericjim @chalin - See similar
angular#1972
hansl added a commit to hansl/angular-cli that referenced this issue Sep 5, 2016
and properly understand and return the modules in this case.

Also refactored that function to be clearer, and added a test to cover.
I made sure the test was failing before this PR ;)

Fixes angular#1891, angular#1960.

cc @filipesilva @ericjim @chalin - See similar
angular#1972
hansl added a commit that referenced this issue Sep 6, 2016
)

* fix(find-lazy-modules): Allow for any valid keys/value to be used
and properly understand and return the modules in this case.

Also refactored that function to be clearer, and added a test to cover.
I made sure the test was failing before this PR ;)

Fixes #1891, #1960.

cc @filipesilva @ericjim @chalin - See similar
#1972

* cleanup
catull pushed a commit to catull/angular-cli that referenced this issue Sep 6, 2016
…gular#1987)

* fix(find-lazy-modules): Allow for any valid keys/value to be used
and properly understand and return the modules in this case.

Also refactored that function to be clearer, and added a test to cover.
I made sure the test was failing before this PR ;)

Fixes angular#1891, angular#1960.

cc @filipesilva @ericjim @chalin - See similar
angular#1972

* cleanup
@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
7 participants