Browse Source

chore: vue config NODE_ENV

Sendya 5 years ago
parent
commit
fb3f92286a
3 changed files with 8 additions and 17 deletions
  1. 3 0
      .env.development
  2. 3 2
      vue.config.js
  3. 2 15
      webstorm.config.js

+ 3 - 0
.env.development

@@ -0,0 +1,3 @@
+NODE_ENV=development
+VUE_APP_PREVIEW=true
+VUE_APP_API_BASE_URL=/api

+ 3 - 2
vue.config.js

@@ -11,7 +11,7 @@ function resolve (dir) {
  * @returns {boolean}
  */
 function isProd () {
-  return process.env.NODE_ENV === 'production' || process.env.VUE_APP_PREVIEW === 'true'
+  return process.env.NODE_ENV === 'production'
 }
 
 const assetsCDN = {
@@ -111,7 +111,8 @@ const vueConfig = {
 }
 
 // preview.pro.loacg.com only do not use in your production;
-if (!isProd()) {
+if (process.env.VUE_APP_PREVIEW === 'true') {
+  console.log('VUE_APP_PREVIEW', true)
   // add `ThemeColorReplacer` plugin to webpack plugins
   vueConfig.configureWebpack.plugins.push(createThemeColorReplacerPlugin())
 }

+ 2 - 15
webstorm.config.js

@@ -1,16 +1,3 @@
 'use strict'
-const path = require('path')
-
-function resolve (dir) {
-  return path.join(__dirname, '.', dir)
-}
-
-module.exports = {
-  context: path.resolve(__dirname, './'),
-  resolve: {
-    extensions: ['.js', '.vue', '.json'],
-    alias: {
-      '@': resolve('src')
-    }
-  }
-}
+const webpackConfig = require('@vue/cli-service/webpack.config.js')
+module.exports = webpackConfig