Skip to content

Scripts.bundle.js deploy-url wrongly prefixed when deviating from standard project structure #8127

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

Closed
ArnaudHambenne opened this issue Oct 20, 2017 · 3 comments
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix

Comments

@ArnaudHambenne
Copy link

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.3
node: 6.11.3
os: darwin x64

Repro steps.

SETUP:
$ ng new scripts-test
$ npm install --save bootstrap

--> Move src/main.ts to src/app/main.ts, and update the reference in .angular-cli.json accordingly:
FROM:
"main": "main.ts",
TO:
"main": "app/main.ts",

--> Move src/index.html to src/app/index.html, and update the reference in .angular-cli.json accordingly:
FROM:
"index": "index.html",
TO:
"index": "app/index.html",

--> Update import urls in src/app/main.ts
FROM:
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
TO:
import { AppModule } from './app.module';
import { environment } from './../environments/environment';

--> add to scripts array in .angular-cli.json the line "../node_modules/bootstrap/dist/js/bootstrap.js"
FROM:
"scripts": [],
TO:
"scripts": ["../node_modules/bootstrap/dist/js/bootstrap.js"],

--> Build the project with deploy-url
$ ng build --deploy-url /app

Desired functionality.

I would like to see some form of consistency within the url building for the bundles. As shown below, every bundles gets prefixed correctly with the deploy-url, except for the scripts bundle.

Result within index.html:

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

<script type="text/javascript" src="/app/../scripts.bundle.js"></script>

<script type="text/javascript" src="/app/styles.bundle.js"></script><script type="text/javascript" src="/app/vendor.bundle.js"></script><script type="text/javascript" src="/app/main.bundle.js"></script>

Mention any other details that might be useful.

I am using the Angular CLI for a multi-page application (technically hybrid), where I want to encapsulate each separate page in a folder within the /src folder. When I build my application with a specified --deploy-url flag, all urls for the bundles within the index page get built correctly, except for the scripts bundle. This one gets prefixed with "../" before being prepended with the deploy-url, rendering the package unreachable when loading the html in a web browser.

@filipesilva filipesilva self-assigned this Oct 25, 2017
@filipesilva filipesilva added severity5: regression type: bug/fix P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful labels Oct 25, 2017
@filipesilva
Copy link
Contributor

This is a regression introduced by #7279. Will fix.

@clydin
Copy link
Member

clydin commented Jan 5, 2018

This should be fixed in 1.6.3. If the problem still occurs, please re-open the issue.

@clydin clydin closed this as completed Jan 5, 2018
@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix
Projects
None yet
Development

No branches or pull requests

3 participants