Skip to content

feat(@angular/cli): add trailing slash to deployUrl when missing #8740

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

Merged
merged 1 commit into from
Jan 3, 2018

Conversation

tomastrajan
Copy link
Contributor

Closes #7295

@filipesilva
Copy link
Contributor

@clydin can you review please?

@clydin
Copy link
Member

clydin commented Dec 27, 2017

As currently implemented, the deploy URL option mimics the behavior of webpack's public path option which simply prepends the value provided to resource requests. So technically this PR would be a breaking change. However, I'm not sure anyone is currently using the option to prepend directly to the filename of the resource (as opposed to the common case of adjusting the path).

Also of note, the CLI's base href option also would typically require the user to use a trailing slash. According to the specification, the trailing slash is actually significant to the meaning of the base href value (i.e., /base/ and /base have different behavior within a web browser).

@tomastrajan
Copy link
Contributor Author

tomastrajan commented Dec 27, 2017

@clydin I had similar worries and asked Webpack guys directly and got response that it is always safe to append trailing slash when missing on publicPath. Then again the context in the question was lacking so it's possible that answer didn't account for all use cases.

EDIT: what I remember from debugging original issue is that it all boils down to

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/something";

in the inline.bundle.js.

This gets correctly resolved (slash is added automatically) for scripts like in index.html

<script type="text/javascript" src="/something/inline.bundle.js">

but not for stuff referenced from sass like in the original issue.

@clydin
Copy link
Member

clydin commented Jan 3, 2018

This is something that webpack should probably fix directly but changing it here as well shouldn't cause a problem.

@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 Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deployUrl (ng build) doesn't seem to add a trailing slash
4 participants