nuxt.config.jsに書くこととは

export default {
ssr: false,


// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: '',
htmlAttrs: {
lang: 'ja',
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{
rel: '',
href: 'https://fonts.googleapis.com',
},
{
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap',
},
],
},


// Global CSS: https://go.nuxtjs.dev/config-css
css: ['src/assets/scss/style.scss'],


// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/plugins.ts',
],


// Auto import components: https://go.nuxtjs.dev/config-components
components: true,


// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
moment: {
locales: ['ja'],
},
srcDir: 'src/',


// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},


router: {
base:
process.env.NODE_ENV === 'preview'
? '/nankodo/chiryoyaku_for_web/front_end/',
extendRoutes(routes, resolve) {
routes.push({ path: '/', redirect: '/top' })


},
},
}

ssr

ssr: false,

SSR(サーバーサイドレンダリング)かCSR(クライアントサーバーレンダリング)を選択します。

 

 

head


head: {
title: '',
htmlAttrs: {
lang: 'ja',
},

サイトのタイトル、言語属性、meta属性、link属性を入れます。

css

cssのパスを入れます。

plugins

pluginを使う場合はpassを入れます。

components

trueにすることで自動的にcomponentがインポートされます。

buildModules

モジュールの読み込みをすなsy。

srcDir

srcのパスを指定します。

router

process.env.NODE_ENVやリダイレクトがあれば指定します。
extendRoutes(routes, resolve) {
  routes.push({ path: '/', redirect: '/top' })
}

コメント

タイトルとURLをコピーしました