Skip to content
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

fix(serve): delete dist on serve #4293

Merged
merged 1 commit into from
Jan 31, 2017
Merged

Conversation

filipesilva
Copy link
Contributor

ng serve will serve the app from memory, but it's easy to think that it just serves what's in dist/.

This way, dist/ is deleted on ng serve and users will not have a dist/ dir where they might think the files are being served from.

Partially address #4290

`ng serve` will serve the app from memory, but it's easy to think that it just serves what's in `dist/`.

This way, `dist/` is deleted on `ng serve` and users will not have a `dist/` dir where they might think the files are being served from.

Partially address angular#4290
@hansl hansl merged commit 8e82d17 into angular:master Jan 31, 2017
MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this pull request Feb 9, 2017
`ng serve` will serve the app from memory, but it's easy to think that it just serves what's in `dist/`.

This way, `dist/` is deleted on `ng serve` and users will not have a `dist/` dir where they might think the files are being served from.

Partially address angular#4290
@filipesilva filipesilva deleted the delete-dist-serve branch February 25, 2017 11:27
@jaesung2061
Copy link

jaesung2061 commented Apr 26, 2017

Why not just notify the user at the terminal?

I am using my public directory instead of dist which also contains other non-angular files.

If this isn't an option, I need to put the built files in a subdirectory like public/build instead. How can I configure the files so that the built html file has example.com/build/main.bundle.js instead of example.com/main.bundle.js

@Brocco
Copy link
Contributor

Brocco commented Apr 26, 2017

@jaesung2061 The output directory (whether dist or public) should be added to .gitignore. And while they may be text files js/html/css they can be considered binary as they are the product of a build process.

That being said, I would suggest creating a assets folder (doesn't need to be named assets) for files to be moved to the output dir upon build which should solve the issues you're having if other files are getting deleted.

@jaesung2061
Copy link

jaesung2061 commented Apr 27, 2017

How can I update the generated html file so that it requests build/*.js instead of /*.js?

<!--This-->
<script type="text/javascript" src="build/inline.bundle.js">

<!--Not this-->
<script type="text/javascript" src="inline.bundle.js">

Or instead of deleting the entire directory, you can delete the known generated files. E.g.

inline.bundle.js
inline.bundle.js.map
main.bundle.js
main.bundle.js.map
polyfills.bundle.js
polyfills.bundle.js.map
styles.bundle.js
styles.bundle.js.map
vendor.bundle.js
vendor.bundle.js.map
index.html

And the files listed in .angular-cli.json under the assets array.

@avbentem
Copy link

Just for your information: note that since 1.1.0-rc.0 ng serve supports --delete-output-path=false, which suppresses deletion of dist (or whatever folder is configured in .angular-cli.json, or on the command line using ng serve --output-path=...).

@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.

6 participants