V
V
Viktor2018-05-28 19:04:58
webpack
Viktor, 2018-05-28 19:04:58

How to build a project with dev config in vue.js webpack template?

I use Vue.js and its webpack template ( https://github.com/vuejs-templates/webpack)
The template provides npm run dev and npm run build commands. The first runs a local server for development, the second builds for production.
This template has /config/dev.env.js and /config/prod.env.js files, where you can stuff various variables, in particular API_URL.
How can I build in the easiest way (not start a local server, but build) an application using variables from dev.env.js?
As I understand it, webpack.prod.conf is used for building, and it needs this line to be taken depending on the npm command, but if done in package.json
const env = require('../config/prod.env')
"build": "NODE_ENV=dev node build/build.js"
and then if-ami look at process.env.NODE_ENV and include different configs, then it didn’t work for me

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question