Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 632d66e

Browse files
refactor: use nuxt netlify files module
1 parent 1100fcf commit 632d66e

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

nuxt.config.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { resolve } from 'path'
2-
import { promises } from 'fs'
32
import { colors } from './tailwind.js'
43
import i18n from './i18n'
54

@@ -97,14 +96,6 @@ export default {
9796
]
9897
},
9998

100-
hooks: {
101-
async 'generate:distCopied' () {
102-
const copyFile = fileName => promises.copyFile(resolve(__dirname, 'netlify', fileName), resolve(__dirname, 'dist', fileName))
103-
const files = ['_redirects', '_headers']
104-
await Promise.all(files.map(copyFile))
105-
}
106-
},
107-
10899
/*
109100
* Meta information
110101
*/
@@ -153,7 +144,8 @@ export default {
153144
['@nuxtjs/axios', { baseURL: '/.netlify/functions/' }],
154145
['nuxt-i18n', i18n],
155146
'nuxt-svg-loader',
156-
'nuxt-webfontloader'
147+
'nuxt-webfontloader',
148+
'@nuxtjs/netlify-files'
157149
].concat(isDev ? '@nuxtjs/proxy' : 'nuxt-purgecss'),
158150

159151
proxy: {
@@ -168,6 +160,10 @@ export default {
168160
}
169161
},
170162

163+
netlifyFiles: {
164+
existingFilesDirectory: './netlify/'
165+
},
166+
171167
workbox: {
172168
offlineAnalytics: true,
173169
runtimeCaching: [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"@nuxtjs/axios": "^5.4.1",
1717
"@nuxtjs/google-analytics": "^2.2.0",
18+
"@nuxtjs/netlify-files": "^1.0.0",
1819
"@nuxtjs/pwa": "^3.0.0-beta.14",
1920
"eslint-plugin-nuxt": "^0.4.3",
2021
"intersection-observer": "^0.6.0",

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,13 @@
12911291
dependencies:
12921292
"@nuxtjs/pwa-utils" "3.0.0-beta.16"
12931293

1294+
"@nuxtjs/netlify-files@^1.0.0":
1295+
version "1.0.0"
1296+
resolved "https://registry.yarnpkg.com/@nuxtjs/netlify-files/-/netlify-files-1.0.0.tgz#2c0d37050431db82b8698e47d1767a13e687da97"
1297+
integrity sha512-5hWJh5V9z84AabuDwdsG2BO1axef7D+UdoGMmiknp7XrN3HwyYblnOgnRlH9U/i8eLXtM28Tb0uC3zwygfB7+A==
1298+
dependencies:
1299+
fs-extra "^8.1.0"
1300+
12941301
"@nuxtjs/proxy@^1.3.3":
12951302
version "1.3.3"
12961303
resolved "https://registry.yarnpkg.com/@nuxtjs/proxy/-/proxy-1.3.3.tgz#3de3d9f073e8e57167168100940be2a824a220e0"
@@ -4315,7 +4322,7 @@ fs-extra@^7.0.1:
43154322
jsonfile "^4.0.0"
43164323
universalify "^0.1.0"
43174324

4318-
fs-extra@^8.0.1:
4325+
fs-extra@^8.0.1, fs-extra@^8.1.0:
43194326
version "8.1.0"
43204327
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
43214328
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==

0 commit comments

Comments
 (0)