You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'use strict';constmerge=require('webpack-merge');constdevEnv=require('./dev.env');module.exports=merge(devEnv,{NODE_ENV: '"test"'// call it '"testing"' if you'd like});
The way to let webpack set the environment variables above and have access to them when npm run dev or npm run prod.
I would advice the owner of this repo to create webpack.test.config dedicated for testing :)
For new developers: When you nom run prodwebpack will insert the process.env.NODE_ENV in plain text. You do not have to worry about anything. Webpack will take of you environment variables :)
// In any Vue component you can use the environment variables as:exportdefault: {data(){
envar: process.env.NODE_ENV}}
I love this repo and I would love this template to thrive!!!! Thank you very much to whoever started this repo!
The text was updated successfully, but these errors were encountered:
@dfcook I posted the solution for new developers. I would love to see it in the template :). So that new Vue developers will understand how powerful is webpack :)
How do I access 'production' mode and 'development' mode using
process.env
?For those who want to have access to the process.env.NODE_ENV inside the
src/
config
folder in the root or inside the/build
config
folder create three files calldev.env.js
,prod.env.js
, andtest.env.js
dev.env.js
file:prod.env.js
filetest.env.js
fileThe way to let
webpack
set the environment variables above and have access to them whennpm run dev
ornpm run prod
.build/webpack.config.dev.js
plugins
array add:build/webpack.config.prod.js
Now you know how to do it for the testing...
I would advice the owner of this repo to create
webpack.test.config
dedicated for testing :)For new developers: When you
nom run prod
webpack will insert the process.env.NODE_ENV in plain text. You do not have to worry about anything. Webpack will take of you environment variables :)I love this repo and I would love this template to thrive!!!! Thank you very much to whoever started this repo!
The text was updated successfully, but these errors were encountered: