Hello,

I have Nx workspace which build my Angular app inside dist/apps/{app_name}. Even if I use output_dir option inside my app spec yaml file (seen in the doc) to point to dist/apps/{app_name} the files taken are, for exemple /apps/front/index.html instead of /index.html.
It seems that the default params (_static, public or dist) override the output_dir option or the default params (here dist) has priority over output_dir option.

Is there a solution to use dist/apps/{app_name} as dir for my Angular app ?

Actually my work-around is to do yarn nx build front && mkdir -p public && mv dist/apps/front/* public && rm -rf dist which is dirty.

Thanks,

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @scorsi

The output_dir option will take priority over the default behavior of checking for a few known directory names (_static, public, dist, build).

It sounds like the output_dir option isn’t being set. If you export your app spec in the UI (App -> Settings -> View App Spec), do you see it on the static site?

UPDATE (Nov 24, 2020) The control panel now supports the Output Directory option in the component settings.

To set this option properly, you will need to update your app spec via doctl or the API as it is not yet exposed via the Web UI:

  1. Install doctl
  2. List your apps and find your app’s UUID: doctl apps list
  3. Save your app’s spec to a file: doctl apps spec get APP-UUID > app.yaml
  4. Open app.yaml in a text editor and add the output_dir property.
  5. Update your app with the new spec: doctl apps update --spec app.yaml APP-UUID. This will kick off a new deployment

Let me know if that works!

  • Hello,

    Thanks for your answer ! I exactly did the same pattern, but the output_dir wasn’t taken into account. I did had:

    static_sites:
    - build_command: yarn nx build front --prod
      environment_slug: node-js
      github:
        branch: main
        deploy_on_push: true
        repo: my-org/my-repo
      name: front
      output_dir: dist/apps/front
      routes:
      - path: /
    
Submit an Answer