rspack icon indicating copy to clipboard operation
rspack copied to clipboard

feat: add initial angular support

Open edusperoni opened this issue 2 years ago • 6 comments

Summary

Angular support is hindered by a couple of missing hooks (beforeCompile, finishModules), missing createChildCompiler, missing NormalModule and its loader hook, and finally, normalModuleFactory (not exposed yet) from the thisCompilation hook.

This PR addresses beforeCompile (not passing the params), finishModules, NormalModule loader hook and createChildCompiler (initial implementation). The angular compilation still fails due to the unexposed normalModuleFactory

Related issue (if exists)

https://github.com/web-infra-dev/rspack/issues/2099

Types of changes

  • [ ] Docs change / Dependency upgrade
  • [ ] Bug fix
  • [x] New feature / Improvement
  • [ ] Refactoring
  • [ ] Breaking change

Checklist

  • [ ] I have added changeset via pnpm run changeset.
  • [ ] I have added tests to cover my changes.

edusperoni avatar Mar 10 '23 15:03 edusperoni

⚠️ No Changeset found

Latest commit: ef4ba2b84b112118ae9b875b9e5e3ba8c273fba5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Mar 10 '23 15:03 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 10 '23 15:03 CLAassistant

Great job! Would you sign the CLA and add a changeset?

h-a-n-a avatar Mar 10 '23 16:03 h-a-n-a

@h-a-n-a cla signed! I'm not sure what other package besides @rspack/core would be affected by my changes, could you provide any guidance on that?

edusperoni avatar Mar 10 '23 16:03 edusperoni

@edusperoni Looks like marking the binding and core is enough. Could you elaborate the missing features of normalModule factory?

h-a-n-a avatar Mar 10 '23 16:03 h-a-n-a

@h-a-n-a the missing features are in the thisCompilation hook. It exists but it doesn't pass the moduleFactories in the arguments, so angular fails to compile (https://github.com/angular/angular-cli/blob/main/packages/ngtools/webpack/src/resource_loader.ts#L182).

I imagine the missing readResourceForScheme from my NormalModule plugin will also need to be implemented

I'll update my changeset later today

edusperoni avatar Mar 13 '23 13:03 edusperoni

Further progress on this: 1- merged latest main on it 2- merged https://github.com/web-infra-dev/rspack/pull/2356 into https://github.com/edusperoni/rspack/tree/chore/create-angular2

with that PR, it gets further, and now we are missing 2 hooks. One is the readResourceForScheme of the NormalModule hooks, and the other is the additionalAssets hook

edusperoni avatar Mar 20 '23 15:03 edusperoni

closing in favor of #3009

edusperoni avatar May 08 '23 14:05 edusperoni