vue js 项目构建中的模式
mode in project building in vue js
我的 vue js 项目中有两个 env
文件
- .env.development
- .env.production
我想使用命令 npm run build --mode development
或 npm run build --mode production
构建项目,以便基于我基于 vue 文档的 env 文件进行构建。
我收到这个错误
Entry module not found: Error: Can't resolve '/var/www/html/projectname/production' in '/var/www/html/projectname'
有什么解决办法??
你的文件设置似乎是正确的,看起来你需要改变你的命令:
npm run build --mode production
至此
npm run build -- --mode production
根据这个 github 线程:https://github.com/vuejs/vue-cli/issues/1528#issuecomment-395970443
复制那里的评论:
"In other words: all arguments before -- are interpreted as arguments for npm itself, not the script you are running."
或者,如果您不使用 npm 脚本快捷方式,您可以直接使用 vue-cli-service
:
vue-cli-service build --mode production
我的 vue js 项目中有两个 env
文件
- .env.development
- .env.production
我想使用命令 npm run build --mode development
或 npm run build --mode production
构建项目,以便基于我基于 vue 文档的 env 文件进行构建。
我收到这个错误
Entry module not found: Error: Can't resolve '/var/www/html/projectname/production' in '/var/www/html/projectname'
有什么解决办法??
你的文件设置似乎是正确的,看起来你需要改变你的命令:
npm run build --mode production
至此
npm run build -- --mode production
根据这个 github 线程:https://github.com/vuejs/vue-cli/issues/1528#issuecomment-395970443
复制那里的评论:
"In other words: all arguments before -- are interpreted as arguments for npm itself, not the script you are running."
或者,如果您不使用 npm 脚本快捷方式,您可以直接使用 vue-cli-service
:
vue-cli-service build --mode production