Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit cef50d0

Browse files
committed
Do not generate 404.html in project root
Netlify dev now picks up the custom 404.html from the publish folder (matching the behavior of deployment on Netlify). We can remove the workaround where we copied the 404.html to the project root. Fix in netlify/cli: netlify/cli#1159
1 parent 3951b19 commit cef50d0

File tree

5 files changed

+0
-24
lines changed

5 files changed

+0
-24
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ Lastly, add the following lines to your `.gitignore`:
135135
# Files generated by next-on-netlify command
136136
/out_publish/
137137
/out_functions/
138-
/404.html
139138
```
140139

141140
Now you're all set.

lib/setupHtmlPages.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ const setupHtmlPages = () => {
2828
}
2929
)
3030
})
31-
32-
// Copy 404.html to directory root
33-
// This is a temporary workaround. Currenly, Netlify (deployed) expects the
34-
// 404.html file in the publish folder, while netlify-cli dev expects it at
35-
// the directory root. In order to cover both cases, we copy the 404.html to
36-
// both locations until this is fixed.
37-
if(existsSync(join(NETLIFY_PUBLISH_PATH, "404.html")))
38-
copySync(join(NETLIFY_PUBLISH_PATH, "404.html"), join(".", "404.html"))
3931
}
4032

4133
module.exports = setupHtmlPages

tests/defaults.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ describe('404 Page', () => {
154154

155155
expect(existsSync(join(OUTPUT_PATH, "404.html"))).toBe(true)
156156
})
157-
158-
// This is required for 404.html to work on netlify-dev
159-
test('copies 404.html to directory root', () => {
160-
expect(existsSync(join(PROJECT_PATH, "404.html"))).toBe(true)
161-
})
162157
})
163158

164159
describe('Public assets', () => {

tests/preRenderedIndexPages.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ describe('404 Page', () => {
8686

8787
expect(existsSync(join(OUTPUT_PATH, "404.html"))).toBe(true)
8888
})
89-
90-
// This is required for 404.html to work on netlify-dev
91-
test('copies 404.html to directory root', () => {
92-
expect(existsSync(join(PROJECT_PATH, "404.html"))).toBe(true)
93-
})
9489
})
9590

9691
describe('Routing',() => {

tests/staticIndexPages.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ describe('404 Page', () => {
8686

8787
expect(existsSync(join(OUTPUT_PATH, "404.html"))).toBe(true)
8888
})
89-
90-
// This is required for 404.html to work on netlify-dev
91-
test('copies 404.html to directory root', () => {
92-
expect(existsSync(join(PROJECT_PATH, "404.html"))).toBe(true)
93-
})
9489
})
9590

9691
describe('Routing',() => {

0 commit comments

Comments
 (0)