Skip to content

Commit

Permalink
tests: add tests for multiple env
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Jul 31, 2020
1 parent a20e702 commit 1847128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/config/type/function-with-env/a.js
@@ -1,3 +1,5 @@
console.log('chuntaro');
// eslint-disable-next-line no-undef
console.log(envMessage || 'env message absent');
if (envMessage) {
console.log('env message present');
}
3 changes: 2 additions & 1 deletion test/config/type/function-with-env/webpack.config.js
@@ -1,6 +1,7 @@
const { DefinePlugin } = require('webpack');

module.exports = (env) => {
console.log({ env });
if (env.isProd) {
return {
entry: './a.js',
Expand All @@ -13,7 +14,7 @@ module.exports = (env) => {
entry: './a.js',
mode: 'development',
stats: env.verboseStats ? 'verbose' : 'normal',
plugins: [new DefinePlugin({ envMessage: env.envMessage ? 'env message present' : '' })],
plugins: [new DefinePlugin({ envMessage: env.envMessage ? JSON.stringify('env message present') : false })],
output: {
filename: 'dev.js',
},
Expand Down

0 comments on commit 1847128

Please sign in to comment.