Commit d7956788 authored by JunHyung An's avatar JunHyung An
Browse files

Add process.env variables

parent 98ce1b0a
Loading
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@
        "eslint": "^8.49.0",
        "eslint-plugin-vue": "^9.17.0",
        "prettier": "^3.0.3",
        "vite": "^4.4.9"
        "vite": "^4.4.9",
        "vite-plugin-env-compatible": "^1.1.1"
      }
    },
    "node_modules/@aashutoshrathi/word-wrap": {
@@ -2553,6 +2554,12 @@
        }
      }
    },
    "node_modules/vite-plugin-env-compatible": {
      "version": "1.1.1",
      "resolved": "https://registry.npmjs.org/vite-plugin-env-compatible/-/vite-plugin-env-compatible-1.1.1.tgz",
      "integrity": "sha512-4lqhBWhOzP+SaCPoCVdmpM5cXzjKQV5jgFauxea488oOeElXo/kw6bXkMIooZhrh9q7gclTl8en6N9NmnqUwRQ==",
      "dev": true
    },
    "node_modules/vue": {
      "version": "3.3.4",
      "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz",
@@ -4311,6 +4318,12 @@
        "rollup": "^3.27.1"
      }
    },
    "vite-plugin-env-compatible": {
      "version": "1.1.1",
      "resolved": "https://registry.npmjs.org/vite-plugin-env-compatible/-/vite-plugin-env-compatible-1.1.1.tgz",
      "integrity": "sha512-4lqhBWhOzP+SaCPoCVdmpM5cXzjKQV5jgFauxea488oOeElXo/kw6bXkMIooZhrh9q7gclTl8en6N9NmnqUwRQ==",
      "dev": true
    },
    "vue": {
      "version": "3.3.4",
      "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz",
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
    "eslint": "^8.49.0",
    "eslint-plugin-vue": "^9.17.0",
    "prettier": "^3.0.3",
    "vite": "^4.4.9"
    "vite": "^4.4.9",
    "vite-plugin-env-compatible": "^1.1.1"
  }
}
+15 −0
Original line number Diff line number Diff line
@@ -3,11 +3,26 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import envCompatiblePlugin from 'vite-plugin-env-compatible';

function publicPath () {
  if (process.env.CI_PAGES_URL) {
    return new URL(process.env.CI_PAGES_URL).pathname
  } else {
    return '/'
  }
}

// https://vitejs.dev/config/
export default defineConfig({
  base: publicPath(),
  plugins: [
    vue(),
    envCompatiblePlugin( /* options */),
  ],
  define: {
      'process.env': process.env,
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))