-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: create JS bundles for each component #6998
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
src/lib/tsconfig-build.json
Outdated
@@ -5,7 +5,7 @@ | |||
"declaration": true, | |||
"stripInternal": false, | |||
"experimentalDecorators": true, | |||
"noUnusedParameters": true, | |||
"noUnusedParameters": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we no longer having this check? Maybe add a comment if necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just trying something during development; reverted
module: `../@angular/${packageName}/${entryPointName}.es5.js`, | ||
es2015: `../@angular/${packageName}/${entryPointName}.js`, | ||
module: `../esm5/${packageName}/${entryPointName}.es5.js`, | ||
es2015: `../esm2015/${packageName}/${entryPointName}.js`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: How does this work with Closure Compiler now? Is there an alternative to the js_module_roots
option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short answer: it doesn't.
I updated the script and left a comment explaining the current situation w/ closure.
src/lib/tsconfig-umd.json
Outdated
"flatModuleId": "@angular/material", | ||
"skipTemplateCodegen": true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that file used anywhere? We now have three tsconfig-XX
files in the lib/
package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just trying something out with this, meant to delete it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level LGTM
8d1216a
to
f50ea1a
Compare
|
f50ea1a
to
ad93c97
Compare
@devversion after this PR we're definitely going to have to parallelize the typescript builds and bundling. With this change it takes over a minute. To paralleize the tasks, we'll need to manually spawn a child process for each, since nodejs is single-threaded. We also probably want to tweak the watch tasks to only re-compile the sub-packages that changed. Let me know if you want to work on all that. All of this will be obsolete when we switch to bazel, but we're at least a month away from making that switch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jelbourn That makes sense. In regards to the tsconfig
per package directory, didn't the tsconfig
in the project root work anymore?
Also LGTM! Nice
@devversion the tsconfig in the root would cause IDEs to autogenerate the wrong imports sometimes. |
Before this change, all of `@angular/material` was bundled into a single, flat JS file. After this change, each top-level component (i.e., each directory under `src/lib`) will be have its own JS file (and d.ts and metadata.json). The benefit of this change is that current versions of webpack will be able to do a much better job of only including the code an app is using. It also allows (but does not require) people to explicitly import from specific components, e.g. ``` import {MdButtonModule} from '@angular/material/button'; `` For development _within Angular Material itself_ we have to use these deeper imports because the root `@angular/material` doesn't exist until we build the relase package. Additionally, this PR adds a `tsconfig.json` for each dir under `src/` with the correct path mappings for that directory, so that IDEs will correctly generate imports. Closure Compiler CI check is also disabled by this PR; it cannot work with the new package structure until a release with google/closure-compiler#2600 is made available.
ad93c97
to
1f240a5
Compare
Caretaker note: both the copy config and the build rules need to updated alongside this change |
Another note: if this gets merged alongside another PR, it will potentially need a build fix (for anything importing from, e.g., |
Before this change, all of `@angular/material` was bundled into a single, flat JS file. After this change, each top-level component (i.e., each directory under `src/lib`) will be have its own JS file (and d.ts and metadata.json). The benefit of this change is that current versions of webpack will be able to do a much better job of only including the code an app is using. It also allows (but does not require) people to explicitly import from specific components, e.g. ``` import {MdButtonModule} from '@angular/material/button'; `` For development _within Angular Material itself_ we have to use these deeper imports because the root `@angular/material` doesn't exist until we build the relase package. Additionally, this PR adds a `tsconfig.json` for each dir under `src/` with the correct path mappings for that directory, so that IDEs will correctly generate imports. Closure Compiler CI check is also disabled by this PR; it cannot work with the new package structure until a release with google/closure-compiler#2600 is made available.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Before this change, all of
@angular/material
was bundled into asingle, flat JS file.
After this change, each top-level component (i.e., each directory under
src/lib
) will be have its own JS file (and d.ts and metadata.json).The benefit of this change is that current versions of webpack will be
able to do a much better job of only including the code an app is using.
It also allows (but does not require) people to explicitly import from specific components,
e.g.
For development within Angular Material itself we have to use these
deeper imports because the root
@angular/material
doesn't exist untilthe actual package is created.
Additionally, this PR adds a
tsconfig.json
for each dir undersrc/
with the correct path mappings for that directory, so that IDEs will
correctly generate imports.
Closure Compiler CI check is also disabled by this PR; it cannot work
with the new package structure until a release with
google/closure-compiler#2600 is made available.
Fixes #4137