diff --git a/.env b/.env
deleted file mode 100644
index d26f4c2..0000000
--- a/.env
+++ /dev/null
@@ -1,2 +0,0 @@
-# vite 服务器端口
-PORT=3344
\ No newline at end of file
diff --git a/package.json b/package.json
index 4da0404..0210b60 100644
--- a/package.json
+++ b/package.json
@@ -75,6 +75,11 @@
     "vite": "^2.5.6",
     "ws": "^8.2.3"
   },
+  "env": {
+    "//": "Will be auto inject to main,renderer,preload process.env",
+    "PORT": 3344,
+    "PORT_WS": 3355
+  },
   "keywords": [
     "vite",
     "electron",
diff --git a/script/build-main.ts b/script/build-main.ts
index 0858943..5220b2a 100644
--- a/script/build-main.ts
+++ b/script/build-main.ts
@@ -5,11 +5,10 @@ import electron from 'electron'
 import minimist from 'minimist'
 import chalk from 'chalk'
 import ora from 'ora'
-import { waitOn, getEnv } from './utils'
+import { waitOn } from './utils'
 import options from './rollup.config'
-import { main } from '../package.json'
+import { main, env } from '../package.json'
 
-const env = getEnv()
 const argv = minimist(process.argv.slice(2))
 const opt = options({ proc: 'main', env: argv.env })
 const TAG = '[build-main.ts]'
@@ -18,7 +17,7 @@ const spinner = ora(`${TAG} Electron main build...`)
 ; (async () => {
   if (argv.watch) {
     // Wait on vite server launched
-    const waitOnState = waitOn({ port: env.PORT as string })
+    const waitOnState = waitOn({ port: env.PORT })
 
     const watcher = watch(opt)
     let child: ChildProcess
@@ -34,7 +33,7 @@ const spinner = ora(`${TAG} Electron main build...`)
         child = spawn(
           electron as unknown as string,
           [path.join(__dirname, `../${main}`)],
-          { stdio: 'inherit' },
+          { env: Object.assign(process.env, env), stdio: 'inherit' },
         )
       } else if (ev.code === 'ERROR') {
         console.log(ev.error)
diff --git a/script/rollup.config.ts b/script/rollup.config.ts
index 6c572a6..8bbbe38 100644
--- a/script/rollup.config.ts
+++ b/script/rollup.config.ts
@@ -6,7 +6,7 @@ import commonjs from '@rollup/plugin-commonjs'
 import replace from '@rollup/plugin-replace'
 import alias from '@rollup/plugin-alias'
 import json from '@rollup/plugin-json'
-import { builtins, getEnv } from './utils'
+import { builtins } from './utils'
 
 export interface ConfigOptions {
   env?: typeof process.env.NODE_ENV
@@ -40,7 +40,7 @@ export default function (opts: ConfigOptions) {
       }),
       replace({
         ...Object
-          .entries({ ...getEnv(), NODE_ENV: opts.env })
+          .entries({ NODE_ENV: opts.env })
           .reduce(
             (acc, [k, v]) => Object.assign(acc, { [`process.env.${k}`]: JSON.stringify(v) }),
             {},
diff --git a/script/utils.ts b/script/utils.ts
index c946e48..b8aa352 100644
--- a/script/utils.ts
+++ b/script/utils.ts
@@ -1,10 +1,7 @@
-import fs from 'fs'
-import path from 'path'
 import { builtinModules } from 'module'
 import { get } from 'http'
 import { green } from 'chalk'
 import { Plugin } from 'rollup'
-import { parse as parseEnv } from 'dotenv'
 
 /** 轮询监听 vite 启动 */
 export function waitOn(arg0: { port: string | number; interval?: number; }) {
@@ -36,16 +33,3 @@ export function typescript(): Plugin {
     name: 'cxmh:rollup-typescript-esbuild',
   }
 }
-
-export function getEnv(): Record<string, string> {
-  try {
-    if (getEnv.env) {
-      return getEnv.env
-    }
-    const env = parseEnv(fs.readFileSync(path.join(process.cwd(), '.env')))
-    return getEnv.env = env
-  } catch (error) {
-    return {}
-  }
-}
-getEnv.env = undefined as (Record<string, string> | undefined) // Just fix ts check
diff --git a/vite.config.ts b/vite.config.ts
index cceb12a..c0c43ec 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,8 +1,8 @@
-require('dotenv').config({ path: join(__dirname, '.env') })
-
+// require('dotenv').config({ path: join(__dirname, '.env') })
 import { join } from 'path'
 import { defineConfig } from 'vite'
 import vue from '@vitejs/plugin-vue'
+import pkg from './package.json'
 
 export default defineConfig(env => {
   return {
@@ -12,7 +12,7 @@ export default defineConfig(env => {
     root: join(__dirname, 'src/render'),
     base: './',
     server: {
-      port: +process.env.PORT,
+      port: pkg.env.PORT,
     },
     resolve: {
       alias: {