scullyio / scully

The Static Site Generator for Angular apps
https://scully.io/
MIT License
2.56k stars 257 forks source link

empty 404.html file is generated #1626

Open anuj-scanova opened 2 years ago

anuj-scanova commented 2 years ago

🐞 Bug report

Description

When rendering Scully, it generates a 404.html file at the root of the output directory with the following content

<!DOCTYPE html><html lang="en-US" dir="ltr"><head>
  <meta charset="utf-8">
  <title>Title</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>

<app-root></app-root>

<script src="runtime.6f0cf46042137677.js" type="module"></script><script src="polyfills.25496f96c6795738.js" type="module"></script><script src="main.a6b398da8515d7cc.js" type="module"></script>

</body></html>

The content of the page is empty, so there is no use for this 404 file.

I created a custom 404 file and add route to the angular router

{
  path: '404.html',
  component: NotFoundComponent
}

But on rendering, it gives an error

  x Error during file write Error: ENOTDIR: not a directory, open '/.../project/dist/static/en-US/404.html/index.html'

🔬 Minimal Reproduction

💻Your Environment

Angular Version:




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 14.1.3
Node: 16.16.0
Package Manager: npm 8.11.0 
OS: darwin arm64

Angular: 14.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1401.3
@angular-devkit/build-angular   14.1.3
@angular-devkit/core            14.1.3
@angular-devkit/schematics      14.1.3
@nguniversal/builders           14.1.0
@nguniversal/express-engine     14.1.0
@schematics/angular             14.1.3
rxjs                            7.5.6
typescript                      4.7.4

Scully Version:




2.1.36

🔥 Exception or Error




  x Error during file write Error: ENOTDIR: not a directory, open '/.../project/dist/static/en-US/404.html/index.html'
nelsongutidev commented 1 year ago

Did you try using this? https://scully.io/docs/Reference/plugins/community-plugins/http404/