const baseURL = process.env.BASE_URL || 'http://localhost:8000/api';
export default {
  srcDir: 'client', //폴더 구조 정의 client의 폴더에 page, assets, middleware등이 있음.
  target: 'server', // 'server': For server side rendering 'static': For static sites

  generate: {
    fallback: true // 404 오류가 발생했을 때, 페이지 이동
  },

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'ezst-frontend',
    htmlAttrs: {
      lang: 'en'
    },
    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' },
    ],
    script: [ //추가 cdn 정의 jquery, brython runner, fontawesome
      { type: 'text/javascript', src: '/vendor/jquery/jquery-3.6.0.min.js'},
      { type: 'text/javascript', src: '/vendor/flipster/jquery.flipster.min.js' },
      { type: 'text/javascript', src: 'https://cdn.jsdelivr.net/gh/pythonpad/brython-runner/lib/brython-runner.bundle.js'},
      { type: 'text/javascript', src: 'https://kit.fontawesome.com/13c40d56ec.js', crossorigin:'anonymous'},
    ]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    '~/assets/fonts/main.css',
    '~/assets/styles/main.scss',

    '~/static/vendor/flipster/jquery.flipster.min.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    { src: '~/plugins/globals.js'},
    { src: '~/plugins/flipster.js'},
    { src: '~/plugins/vue-codemirror', ssr: false },
    { src: '~/plugins/persistedState.js'}, // 새로고침 해도 state 유지 (cookie로 저장) (vercel 오류 발생)
    { src: '~/plugins/vue-plyr', mode: 'client' },
    { src: '~/plugins/iamport.js', ssr: false, injectAs: 'IMP' },
  ],

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

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [ //env 파일 사용
    '@nuxtjs/dotenv'
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/buefy
    'nuxt-buefy',
    '@nuxtjs/axios',
    '@nuxtjs/auth-next',
  ],

  axios: {
    baseURL: baseURL
  },

  auth: {
    plugins: [ '~/plugins/auth.js' ],
    redirect: {
      home: false,
      callback: '/login',
      logout: '/'
    },
    strategies: {
      google: {
        clientId: process.env.GOOGLE_CLIENT_ID,
        codeChallengeMethod: '',
        responseType: 'code',
        endpoints: {
          token: `${baseURL}/social-login/google/`,
          userInfo: `${baseURL}/user/`,
          logout: false
        },
      },
      naver: {
        scheme: 'oauth2',
        clientId: process.env.NAVER_CLIENT_ID,
        codeChallengeMethod: '',
        responseType: 'code',
        // grantType: 'authorization_code',
        endpoints: {
          authorization: 'https://nid.naver.com/oauth2.0/authorize',
          token: `${baseURL}/social-login/naver/`,
          userInfo: `${baseURL}/user/`,
        },
        token: {
          property: 'access_token',
          type: 'Bearer',
          maxAge: 18000
        },
      },
    }
  },
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    extend(config) {
      config.resolve.alias['vue'] = 'vue/dist/vue.common'
    }
  },
  publicRuntimeConfig: {
    baseUrl: baseURL,
  },
  env: {
    serverUrl: process.env.SERVER_URL || 'http://localhost:8000',
  },
}

'Front-End > Vue & Nuxt' 카테고리의 다른 글

Nuxt 라이브러리 적용  (0) 2022.02.15
Vercel 배포  (0) 2022.02.10
Hide Navbar on Scroll Down in Vue  (0) 2022.01.05
Nuxt.js Async, Fetch  (0) 2022.01.05
Nuxt.js 동작 정리  (0) 2021.12.28

+ Recent posts