diff --git a/frontend/Caddyfile b/frontend/Caddyfile new file mode 100644 index 0000000..84cfc09 --- /dev/null +++ b/frontend/Caddyfile @@ -0,0 +1,18 @@ +:7000 + +log { + format single_field common_log +} + +encode gzip + +root * dist +file_server + +try_files {path} /200.html + +@nuxt { + path /_nuxt/* +} + +header @nuxt Cache-Control "public,max-age=31536000,immutable" # 1 year diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index a2d4861..28e0fc2 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -1,5 +1,3 @@ -import cheerio from 'cheerio' - export default ({ command }) => ({ mode: 'universal', /* @@ -100,9 +98,6 @@ export default ({ command }) => ({ middleware: ['auth'], }, - generate: { - fallback: '404.html', - }, /* ** Build configuration */ @@ -155,16 +150,4 @@ export default ({ command }) => ({ ['font', 'script', 'style'].includes(asType), }, }, - - hooks: { - 'generate:page': (page) => { - const doc = cheerio.load(page.html) - doc(`html`).removeAttr('data-n-head-ssr').removeAttr('data-n-head') - doc(`head meta`).removeAttr('data-n-head').removeAttr('data-hid') - doc(`head link`).removeAttr('data-n-head').removeAttr('data-hid') - doc(`head style`).removeAttr('data-vue-ssr-id') - doc(`#__nuxt`).removeAttr('data-server-rendered') - page.html = doc.html() - }, - }, }) diff --git a/frontend/package.json b/frontend/package.json index 8744581..5bd5d96 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,7 @@ "build": "nuxt build", "start": "nuxt start", "generate": "nuxt generate --modern", - "serve": "caddy file-server --root dist --listen :7000 --access-log", + "serve": "caddy run", "lint": "eslint --ext .js,.vue --ignore-path .gitignore ." }, "dependencies": { @@ -31,7 +31,6 @@ "@nuxtjs/eslint-module": "^1.1.0", "@nuxtjs/tailwindcss": "^2.0.0", "babel-eslint": "^10.1.0", - "cheerio": "^1.0.0-rc.3", "dotenv": "^8.2.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.11.0",