litemall源码阅读2.06管理后台前端litemall-admin之vuecli服务配置文件

.env.deployment

.env.deployment

.env.production

这三个文件决定了执行vuecli serve 时的环境变量配置。

参考:

https://cli.vuejs.org/zh/guide/mode-and-env.html

当执行cnpm run dev时,会执行.env.production。

其内容如下:

ENV = 'development'

VUE_APP_BASE_API = 'http://localhost:8080/admin'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
# It only does one thing by converting all import() to require().
# This configuration can significantly increase the speed of hot updates,
# when you have a large number of pages.
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js


VUE_CLI_BABEL_TRANSPILE_MODULES = true

指定了后台服务的接口的地址VUE_APP_BASE_API 

,并且设置了一个VUE_CLI_BABEL_TRANSPILE_MODULES变量。

这个变量的意义是,在测试环境下禁止js代码的转义,而只把相关的模块导出和导入,提高开发环境下的运行效率。

其他两个文件

.env.deployment  cnpm run build:dep启动

.env.deployment  cnpm run build启动

只是单纯的指定了后台服务接口的地址。

原文地址:https://www.cnblogs.com/xiaoBay/p/14009704.html