plan for ssg
This commit is contained in:
1 parent
a8867be72c
commit
fb69b2710f
73 files changed
+921
-718
No files matched your search
@@ -1,10 +1,11 @@
|
||||
import { NuxtConfig } from '@nuxt/types'
|
||||
|
||||
import { SERVER_PORT, runServer } from './server/cli'
|
||||
import { getTheme } from './server/theme'
|
||||
|
||||
const config = async (): Promise<NuxtConfig> => {
|
||||
await runServer()
|
||||
const theme = getTheme()
|
||||
const PORT = process.env.PORT || '3000'
|
||||
|
||||
return {
|
||||
// Global page headers (https://go.nuxtjs.dev/config-head)
|
||||
@@ -55,11 +56,7 @@ const config = async (): Promise<NuxtConfig> => {
|
||||
css: [],
|
||||
|
||||
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
|
||||
plugins: [
|
||||
'~/plugins/axios-fix.ts',
|
||||
'~/plugins/format.ts',
|
||||
'~/plugins/remark42.client.js',
|
||||
],
|
||||
plugins: ['~/plugins/axios-fix.ts', '~/plugins/format.ts'],
|
||||
|
||||
// Auto import components (https://go.nuxtjs.dev/config-components)
|
||||
components: true,
|
||||
@@ -73,13 +70,35 @@ const config = async (): Promise<NuxtConfig> => {
|
||||
// Modules (https://go.nuxtjs.dev/config-modules)
|
||||
modules: ['@nuxtjs/axios'],
|
||||
|
||||
axios: {
|
||||
proxy: true,
|
||||
},
|
||||
proxy: {
|
||||
'/.netlify/functions': 'http://localhost:9000',
|
||||
'/api': `http://localhost:${SERVER_PORT}`,
|
||||
},
|
||||
|
||||
// Build Configuration (https://go.nuxtjs.dev/config-build)
|
||||
build: {},
|
||||
env: {
|
||||
THEME: JSON.stringify(theme),
|
||||
PORT,
|
||||
SERVER_PORT: SERVER_PORT.toString(),
|
||||
},
|
||||
hooks: {
|
||||
generate: {
|
||||
done() {
|
||||
/**
|
||||
* Do not kill
|
||||
*/
|
||||
// try {
|
||||
// execSync(
|
||||
// `lsof -i tcp:${SERVER_PORT} | grep LISTEN | awk '{print $2}' | xargs kill -9`
|
||||
// )
|
||||
// } catch (_) {}
|
||||
process.exit(0)
|
||||
},
|
||||
},
|
||||
},
|
||||
serverMiddleware: [{ path: '/api', handler: '~/server/index.ts' }],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user