Skip to content

build: remove module id references for components in release output #17625

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

Conversation

devversion
Copy link
Member

Currently when building the libary with Gulp, we manually inline
resources and remove the moduleId properties. This is actually
why #13883 never came up until Bazel was a thing.

Since we now release with Bazel and rely on the official resource
inlining from @angular/compiler-cli we no longer have control to
omit the moduleId properties. Technically since resources are
inlined, the moduleId is unnecessary and can cause unexpected
behavior. So this could be considered a bug in compiler-cli.

Possible fix: angular/angular#33621.

For now though, since it's unlikely that this is fixed upstream
in RC phase, we manually patch the NGC resource inlining transform
to also remove the moduleId property.

Keeping moduleId can cause errors in the UMD bundles like:

ReferenceError: module is not defined
    at eval (http://localhost:9876/base/node_modules/@angular/material/bundles/material-core.umd.js:1528:35)

Currently when building the libary with Gulp, we manually inline
resources and remove the `moduleId` properties. This is actually
why angular#13883 never came up
until Bazel.

Since we now release with Bazel and rely on the official resource
inlining from `@angular/compiler-cli` we no longer have control to
omit the `moduleId` properties. Technically since resources are
inlined, the `moduleId` is unnecessary and can cause unexpected
behavior. So this could be considered a bug in compiler-cli.

Possible fix: angular/angular#33621.

For now though, since it's unlikely that this is fixed upstream
in RC phase, we manually patch the NGC resource inlining transform
to also remove the `moduleId` property.
@devversion devversion added pr: merge safe target: patch This PR is targeted for the next patch release labels Nov 6, 2019
@devversion devversion added this to the 9.0.0 milestone Nov 6, 2019
@devversion devversion requested review from jelbourn and a team as code owners November 6, 2019 10:30
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 6, 2019
@devversion
Copy link
Member Author

devversion commented Nov 6, 2019

angular/angular#33621 should fix the issue upstream in framework. Though this fix is specific to output built with ngc. I wonder how this eventually will look like with ngtsc/Ivy since there doesn't seem to be logic for resource inlining. I guess that's a separate question for the future though.

@jelbourn
Copy link
Member

jelbourn commented Nov 6, 2019

Rather than applying another patch, we could just remove all of the moduleId use and add it back in as part of our sync into Google. That seems like it would be a bit more straightforward to me, since something Google-specific stays in a place that's Google-specific. Thoughts?

@devversion
Copy link
Member Author

If you think that is do-able as part of the sync, then I'd be happy to remove the references to moduleId. That would definitely make things easier on the public side.

@devversion
Copy link
Member Author

Closing in favor of #17626

@devversion devversion closed this Nov 6, 2019
@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 Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants