Skip to content

ng build fails to copy .htaccess, and possibly other similarly named files, to the output #1758

Closed

Description

@NgxDev

.htaccess file from public folder isn't copied over to dist on ng build

angular-cli: 1.0.0-beta.11-webpack.2
node: 6.4.0
os: win32 x64

Activity

  1. hansl commented on Aug 19, 2016

    @hansl
    Contributor

    @TheLarkInn Are you not copying dot files over?

  2. added this to the milestone on Aug 19, 2016
  3. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Aug 23, 2016
  4. added a commit that references this issue on Aug 26, 2016
    8c566ca
  5. NgxDev commented on Aug 30, 2016

    @NgxDev
    Author

    My .htaccess file from the public folder still isn't being copied over to dist on build.
    In addition to that, now any file from the public folder isn't copied, not just .dot files.

    angular-cli: 1.0.0-beta.11-webpack.8
    node: 6.4.0
    os: win32 x64
    

    EDIT: Hmmm... I've just ng new a new app instead of ng init on an old one. And I see that there is no public folder anymore.
    But now... I have no place to put my .htaccess. If I put it in src directly, it still isn't copied over. And assets is no place for .htaccess file - it needs to be in the root directory (my case is just about .htaccess, but maybe other files would also need that).
    Now, with public gone, I don't know where to put files that we might need to be copied over to dist (the root of dist, not in other subfolders of dist)

  6. chateaux commented on Mar 23, 2017

    @chateaux

    I was having this issue as well and then I realised that I am just being stupid.

    I was initially running the build process manually and copying a zip of the distribution to the server and unzipping it. Prior to the zip I would copy any other files I needed into the distribution.

    This is/was a pain to do.

    However, once I have completed testing something, it gets moved into a git/jenkins scenario which makes life very simple.

    This is my workflow:

    1. Commit to github
    2. Jenkins is notified and pulls the code (obviously not develop code)
    3. Jenkins compiles the code for distribution (ng build --prod --aot)
    4. Jenkins copies to the dist folder all my required files (htaccess, robots, etc.)
    5. Jenkins scp's a tar of the dist to my server.
    6. Jenkins deletes server files and untars the new environment.

    Takes at most two minutes from start to end and to initiate the process is pretty much a: git push upstream master from my local command line.

    Ideally I would like a method to include the files via ng-cli settings... however, there are simple solutions when you put your mind to it.

  7. gigmaps commented on Mar 28, 2017

    @gigmaps

    to anyone reading this old thread (as it's the first link showing on a search)
    the solution is here:
    #4607

  8. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenttype: bug/fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions