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

feat: webpack plugin to support AoT natively #2333

Merged
merged 1 commit into from Sep 28, 2016
Merged

feat: webpack plugin to support AoT natively #2333

merged 1 commit into from Sep 28, 2016

Conversation

@hansl
Copy link
Contributor

hansl commented Sep 24, 2016

No description provided.

@googlebot
Copy link

googlebot commented Sep 24, 2016

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@googlebot googlebot added the cla: no label Sep 24, 2016
@hansl
Copy link
Contributor Author

hansl commented Sep 24, 2016

Both @robwormald and I are Google employees and therefore agree to the CLA.

@hansl hansl force-pushed the hansl:aot branch 3 times, most recently from 3550f17 to 20367f4 Sep 24, 2016
@hansl hansl added cla: yes and removed cla: no labels Sep 24, 2016
@googlebot googlebot added cla: no and removed cla: yes labels Sep 25, 2016
@hansl hansl force-pushed the hansl:aot branch from 0a807e6 to bf822f4 Sep 25, 2016
this.lazyRoutes = lazyModules.reduce((lazyRoutes: any, lazyModule: any) => {
lazyRoutes[`${lazyModule}.ngfactory`] = path.join(
path.resolve(process.cwd(), this.angularCompilerOptions.genDir),
'app', lazyModule + '.ngfactory.ts'

This comment has been minimized.

Copy link
@robwormald

robwormald Sep 26, 2016

Contributor

i realized this is hardcoded and would fail for anything other than app - should be I guess the relative path between the ngfactory directory and the app's root.

This comment has been minimized.

Copy link
@hansl

hansl Sep 27, 2016

Author Contributor

Fixed.

@hansl hansl force-pushed the hansl:aot branch 14 times, most recently from 2be135e to d6fbf39 Sep 26, 2016
@hansl hansl force-pushed the hansl:aot branch 2 times, most recently from 42df2c8 to 6b0d77e Sep 27, 2016

// Super simple TS transpiler loader for testing / isolated usage. does not type check!
export function ngcLoader(source: string) {
const plugin = this._compilation._ngToolsWebpackPluginInstance as NgcWebpackPlugin;

This comment has been minimized.

Copy link
@TheLarkInn

TheLarkInn Sep 27, 2016

Member

This may be fine for now and once we drop webpack v2. I'm not sure when we are going to start giving deprecation warnings though for trying to access _compilation.

cc @sokra when he gets back from vacation. Maybe we need to have a way to supress warnings of these deprecations of this._compilation being unavailable from loaders on a per-plugin basis. That way this usage is acceptable for now, but in the future we can tail it off.

This comment has been minimized.

Copy link
@hansl

hansl Sep 27, 2016

Author Contributor

I really want to make a point that we need access to compilation in many cases, inside the loaders.

This comment has been minimized.

Copy link
@hansl

hansl Sep 27, 2016

Author Contributor

Or at least access to plugins, yes.

Copy link
Member

TheLarkInn left a comment

Of course the regex but you said you were going to get to that.

@hansl hansl force-pushed the hansl:aot branch 5 times, most recently from 1ae9b65 to 4989a45 Sep 27, 2016
{ test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] },
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.ts$/, loader: '@ngtools/webpack' }

This comment has been minimized.

Copy link
@TheLarkInn

TheLarkInn Sep 28, 2016

Member

We thinking about changing name of loader for the future? Not really worried but I'm sure theres some post merge 🚲 shedding to be done haha.

This comment has been minimized.

Copy link
@TheLarkInn

TheLarkInn Sep 28, 2016

Member

I guess since this is the test app, its really not a big deal at all.

This comment has been minimized.

Copy link
@hansl

hansl Sep 28, 2016

Author Contributor

I'm not thinking of changing it, but we could. What were you thikning of?

This comment has been minimized.

Copy link
@TheLarkInn

TheLarkInn Sep 28, 2016

Member

Not sure yet, this is fine.

Copy link
Member

TheLarkInn left a comment

:shipit:

@Brocco
Brocco approved these changes Sep 28, 2016
@deebloo
Copy link
Contributor

deebloo commented Sep 28, 2016

You guys are killing it! Looking forward to this very much

Also adding a new package, webpack, which is a plugin and loader for
webpack that adds support for AoT.

It is behind a `--aot` flag in the CLI that is supported by build and
serve.
@hansl hansl force-pushed the hansl:aot branch from 0d14dc8 to df5eeaf Sep 28, 2016
@googlebot
Copy link

googlebot commented Sep 28, 2016

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Sep 28, 2016
@hansl hansl merged commit d296778 into angular:master Sep 28, 2016
1 of 3 checks passed
1 of 3 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
cla/google All necessary CLAs are signed
@ginsleepy
Copy link

ginsleepy commented Sep 29, 2016

Does this work with lazy loading?
It says "Cannot find module 'app/about/about.module.ngfactory'"

it is not generating chunk.js file either. Also I cannot find any class related to the Module in main.bundle.js

@rolandoldengarm
Copy link

rolandoldengarm commented Sep 29, 2016

How would I use this? There's no documentation in the commits as far as I can see?

@shprink
Copy link

shprink commented Sep 29, 2016

@rolandoldengarm use --aot option

JJayet added a commit to JJayet/angular-cli that referenced this pull request Oct 2, 2016
Also adding a new package, webpack, which is a plugin and loader for
webpack that adds support for AoT.

It is behind a `--aot` flag in the CLI that is supported by build and
serve.
deebloo added a commit to deebloo/angular-cli that referenced this pull request Oct 3, 2016
Also adding a new package, webpack, which is a plugin and loader for
webpack that adds support for AoT.

It is behind a `--aot` flag in the CLI that is supported by build and
serve.
@fkolar
Copy link

fkolar commented Oct 6, 2016

While looking at this push: d296778

Does it mean it will be offically supported in the next version of Angular-cli version 17?

Unless somebody wants to pull master ?

thanks,
-fk

@achimha
Copy link

achimha commented Oct 9, 2016

Is there any documentation available? I've been trying to get it to work for some time now. It doesn't build my lazily loaded routes and complains about the ngfactory files not found.

Are there any changes for bootstrapping the app?

@filipesilva
Copy link
Member

filipesilva commented Oct 10, 2016

@achimha all changes needed should be done in memory.

We don't yet have documentation but basically you can use the --aot flag in build/serve and... that should be all really. There might still be a few bugs, though. See this label for listing: https://github.com/angular/angular-cli/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature%3A+aot%22

@hansl hansl deleted the hansl:aot branch Nov 2, 2016
@angular-automatic-lock-bot
Copy link

angular-automatic-lock-bot bot commented Sep 10, 2019

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 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.