-
Notifications
You must be signed in to change notification settings - Fork 12k
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
refactor(build): consolidate build options #4105
refactor(build): consolidate build options #4105
Conversation
e657f2c
to
c93ffca
Compare
Could you move |
@hansl I'll do that in a followup PR. There's a few followups to this one that I want to do, but trying to keep the scope of each down. |
|
||
const project = this.cliProject; | ||
|
||
const outputDir = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir; | ||
const deployUrl = runTaskOptions.deployUrl || |
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.
seemed you remove the functionality of using deployUrl via the config file
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.
Sorry.
I just find it in addAppConfigDefaults
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 transferred it over to packages/angular-cli/models/webpack-config.ts
, in the addAppConfigDefaults
function.
To make sure your functionality in #4090 also is in, I force a value for deployUrl
in packages/angular-cli/tasks/serve-webpack.ts
via serveDefaults
.
This way in for ng serve
, the default for --deploy-url
is ''
instead of undefined and thus the default in angular-cli.json
is not used.
I believe this was your intention.
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.
Yes, that is my intention.
Did you test the css url path whether it points to the correct place with --extractCss=false
and --deploy-url
?
I suspect it may have same issue like:
#4035
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 refactored the tests around a bit and that test is in tests/e2e/tests/build/styles/extract-css.ts
, the last test. Can you double check if that's right?
c93ffca
to
dedf216
Compare
<script type="text/javascript" src="common-entry.bundle.js"></script> | ||
<script type="text/javascript" src="main.bundle.js"></script> | ||
`)) | ||
// verify --deploy-url isn't applied to extracted urls | ||
.then(() => ng('build', '--extract-css', '--deploy-url=client/')) |
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.
Can we add a test with --deploy-url=client/
and --extract-css=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.
What should be the output?
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 think if --extract-css=false
, styles will be inserted as <style>
tags into the index.html
. Normally the index.html
will not be under the same path with deploy-url
, so the CSS asset url should point to the full path [deployUrl]/[assetName]
. In this case, the correct result should be client/more.svg
However, I cannot make sure now. I will have a check tomorrow.
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.
@filipesilva
Sorry for keep editing the comment....
Not sure what the expect result right now. Will update after verifying later
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.
Ok let me know when you figure it out. Worst case scenario the new test goes into a new PR.
I believe there should be a way --deployUrl/
also work with ng serve
(it's mentioned here) but haven't looked into it much as it's out of scope of this PR.
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.
Confirmed.
Should be the full path [deployUrl]/[assetName]
. In this case, it is client/more.svg
.
Do not how you test it, because the CSS is inserted by JavaScript when page is loaded
a6896a0
to
90c9dd1
Compare
@changLiuUNSW added this test to address #4105 (comment)
Edit: updated the test, turns out the import looks like this instead: |
8746401
to
dab74e8
Compare
LGTM |
d339bb1
to
dfa54da
Compare
Please update documentation to account for changes in options. For example output path's alias has gone from |
bbc9e53
to
62f8f98
Compare
Fix angular#4138 BREAKING CHANGE: - `--extractCss` defaults to `false` on all `--dev` (`ng build` with no flags uses `--dev`) - `--aot` defaults to true in `--prod` - the alias for `--output-path` is now `-op` instead of `-o`
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. |
Fix #4138
BREAKING CHANGE:
--extractCss
defaults tofalse
on all--dev
(ng build
with no flags uses--dev
)--aot
defaults to true in--prod
--output-path
is now-op
instead of-o