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

cli: dist/static does not include assets if Angular project is output to dist/ #56

Closed
Splaktar opened this issue Dec 19, 2019 · 17 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@Splaktar
Copy link
Contributor

Splaktar commented Dec 19, 2019

🐞 Bug report

Description

In dist/static, I have the following

  • index.html
  • assets
    • scully-routes.json

My webmanifest.manifest, favicon.ico, sitemap.xml, robots.txt, etc aren't available on my static site. It seems like all of this stuff is configured in the angular.json and part of my build in dist/, so it seems like Scully should copy that over for the static site? Or is there some other step or approach that I'm missing?

🔬 Minimal Reproduction

  1. Generate a new app with the CLI
  2. Follow the Scully docs
  3. Check to see if your favicon.ico loads on your static site and that it's in dist/static/favicon.ico

💻Your Environment

Angular Version:


Angular CLI: 9.0.0-rc.6
Node: 12.13.0
OS: darwin x64

Angular: 9.0.0-rc.6
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.6
@angular-devkit/build-angular     0.900.0-rc.6
@angular-devkit/build-optimizer   0.900.0-rc.6
@angular-devkit/build-webpack     0.900.0-rc.6
@angular-devkit/core              9.0.0-rc.6
@angular-devkit/schematics        9.0.0-rc.6
@angular/cdk                      9.0.0-rc.5
@angular/fire                     5.2.3
@angular/material                 9.0.0-rc.5
@ngtools/webpack                  9.0.0-rc.6
@schematics/angular               9.0.0-rc.6
@schematics/update                0.900.0-rc.6
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.2

Scully Version:


    "@scullyio/init": "0.0.8",
    "@scullyio/ng-lib": "latest",
    "@scullyio/scully": "latest",

🔥 Exception or Error


GET http://localhost:5000/firebase-performance-es2015.js net::ERR_ABORTED 404 (Not Found)
(index):2790 GET http://localhost:5000/runtime-es2015.js net::ERR_ABORTED 404 (Not Found)
4(index):2790 GET http://localhost:5000/polyfills-es2015.js net::ERR_ABORTED 404 (Not Found)
16(index):2762 GET http://localhost:5000/assets/DevIntentLogo.png 404 (Not Found)
(index):2790 GET http://localhost:5000/assets/material-design-icons/MaterialIcons-Regular.woff2 net::ERR_ABORTED 404 (Not Found)
(index):2792 GET http://localhost:5000/assets/material-design-icons/MaterialIcons-Regular.woff net::ERR_ABORTED 404 (Not Found)
(index):1 GET http://localhost:5000/assets/material-design-icons/MaterialIcons-Regular.ttf net::ERR_ABORTED 404 (Not Found)
manifest.webmanifest:1 GET http://localhost:5000/manifest.webmanifest 404 (Not Found)
manifest.webmanifest:1 Manifest: Line: 1, column: 1, Syntax error.
favicon.ico:1 GET http://localhost:5000/favicon.ico 404 (Not Found)
favicon-32x32.png:1 GET http://localhost:5000/assets/favicon-32x32.png 404 (Not Found)
favicon-16x16.png:1 GET http://localhost:5000/assets/favicon-16x16.png 404 (Not Found)
@Splaktar Splaktar added the bug Something isn't working label Dec 19, 2019
@Splaktar Splaktar changed the title dist/static does not include assets cli: dist/static does not include assets Dec 19, 2019
@IxquitilisSaid
Copy link
Contributor

Do you have a repo we can use for reproducing/debugging that?

@Splaktar
Copy link
Contributor Author

Not at this time. I can try to set one up in the next few days. Are you seeing the assets being properly available in your app?

@jorgeucano
Copy link
Contributor

@Splaktar thanks for found the issue! ... @SanderElias can you check this?

SanderElias added a commit that referenced this issue Dec 20, 2019
@SanderElias
Copy link
Contributor

@Splaktar The first step we take in Scully, is to copy over all the files in the app's dist folder, including the assets that are there. I just double-checked, and it is doing that for me
image

@jorgeucano Can you check my commit a38f810 and try it on your windows & mac? after running scully, the herodevs logo should be in static/assets/images?

@SanderElias SanderElias self-assigned this Dec 20, 2019
@jorgeucano
Copy link
Contributor

jorgeucano commented Dec 20, 2019

in mac i create 2 builds, one with image and other with txt and work
Captura de Pantalla 2019-12-20 a la(s) 08 12 34
Captura de Pantalla 2019-12-20 a la(s) 08 15 13

@jorgeucano
Copy link
Contributor

I test the same in windows and work
Annotation 2019-12-20 083040

@Splaktar can you test again with the lastest version?

@Splaktar
Copy link
Contributor Author

Yeah, I tested after updating to 0.0.9 and I'm still seeing this issue. One difference that I notice is that you have the following output:

😄 new Angular build imported

But I don't:

scully

Cleaned up /Users/splaktar/Git/.../dist/static/ folder.
started servers in background
servers available
Finding all routes in application.
Pull in data to create additional routes.
Route list created in files:
      src/assets/scully-routes.json
      /Users/splaktar/Git/.../dist/static/assets/scully-routes.json
Route "" rendered into file: "/Users/splaktar/Git/.../dist/static/index.html"
Route list created in files:
      src/assets/scully-routes.json
      /Users/splaktar/Git/.../dist/static/assets/scully-routes.json

Generating took 6.11 seconds for 1 pages:
  That is 0.17 pages per second,
  or 6115 milliseconds for each page.

@Splaktar
Copy link
Contributor Author

$ ls dist/static/assets
scully-routes.json

$ ls dist/assets
AngularJS_square_588x588.png            Maps_icon.png                           angular-cli.svg                         browserconfig.xml                       material-design-512x512.png             safari-pinned-tab.svg
Logo.png                       android-chrome-192x192.png              [email protected]                 favicon-16x16.png                       material-design-icons/                   scully-routes.json
site_preview.png              android-chrome-512x512.png              angular-logo.png                        favicon-32x32.png                       mstile-150x150.png                      typescript.svg
Firebase_128px-logo.png                 android-icon-128px.png                  angular-material.svg                    font-awesome/                            nodejs-icon-128.png
Google-Chrome-icon_256x256.png          angular-cdk.svg                         angular-nativescript-icon.png           google-cloud-logo-icon-128px.png        nx-logo-blue-gradient-128x128.png

@Splaktar
Copy link
Contributor Author

Splaktar commented Dec 20, 2019

I have been testing in another repo (https://github.com/Splaktar/test-blog) and I haven't been able to reproduce the issue so far.

The only difference is that my app puts its output in dist/ and in my new repo the output goes in dist/test-blog. So it looks like Scully may not be able to handle the older style Angular CLI project format.

@jorgeucano
Copy link
Contributor

ok, that's really important!! thanks @Splaktar !!
@SanderElias Can scully check this?

@Splaktar
Copy link
Contributor Author

OK, I changed my project to output to dist/web instead of dist/ in angular.json and I now get the 😄 new Angular build imported and my assets are all properly copied.

@Splaktar Splaktar changed the title cli: dist/static does not include assets cli: dist/static does not include assets if Angular project is output to dist/ Dec 20, 2019
@Splaktar
Copy link
Contributor Author

Splaktar commented Dec 20, 2019

@SanderElias Scully should be able to check the architect->build->options->outputPath field in angular.json in order to find out where the application is output during the build.

@SanderElias
Copy link
Contributor

SanderElias commented Dec 20, 2019 via email

@ahmetuysal
Copy link

OK, I changed my project to output to dist/web instead of dist/ in angular.json and I now get the 😄 new Angular build imported and my assets are all properly copied.

I also have the same issue and this workaround worked.

@aaronfrost
Copy link
Contributor

@SanderElias is going to fix this. @SanderElias do you have a timeline?

@SanderElias SanderElias added wontfix This will not be worked on and removed bug Something isn't working labels Jan 13, 2020
@SanderElias
Copy link
Contributor

I looked into this.
What happens is a race condition if the CLI outputs to the dist root folder.
As Scully by default uses a subfolder of dist, most operating systems get confused.
There are 2 solutions.

  1. make sure the CLI uses a subfolder in dist. (As discussed above)
  2. move the Scully generated files outside of the dist
    I have a serious issue with option 2, as I don't want distribution artifacts to live outside of the dist folder.
    That leaves us with option 1. Which is what we already have.
    We will put some emphasis on this in the documentation. As there is nothing actionable on this, I'm closing this issue.

@Splaktar
Copy link
Contributor Author

@Villanuevand Perhaps we should leave this open until the docs for it can be updated? I don't see this documented anywhere just yet.

SanderElias added a commit that referenced this issue Jan 16, 2020
…path in angular.json

We will run into trouble when an user uses './dist` without subfolder. This PR does docuent that,
and also make scully check, and throw en error when this is detected

re #56
SanderElias added a commit that referenced this issue Jan 16, 2020
…path in angular.json (#188)

We will run into trouble when an user uses './dist` without subfolder. This PR does docuent that,
and also make scully check, and throw en error when this is detected

re #56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

6 participants