--prod not work envVars webpack,config.json

my webpack.config.js:

envVars not work with command: ionic cordova run browser --prod
but work with command: ionic cordova run browser

how solve this


var path = require('path');
var webpack = require('webpack');
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY);

var ModuleConcatPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin');

var envVars = require('./.env.json');

var prodPlugins = [];
if (process.env.IONIC_ENV === 'prod') {
    prodPlugins.push(new ModuleConcatPlugin());
}

module.exports = {
    entry: process.env.IONIC_APP_ENTRY_POINT,
    output: {
        path: '{{BUILD}}',
        publicPath: 'build/',
        filename: '[name].js',
        devtoolModuleFilenameTemplate: ionicWebpackFactory.getSourceMapperFunction(),
    },
    devtool: process.env.IONIC_SOURCE_MAP_TYPE,

    resolve: {
        extensions: ['.ts', '.js', '.json'],
        modules: [path.resolve('node_modules')]
    },

    module: {
        loaders: [
            {
                test: /\.json$/,
                loader: 'json-loader'
            },
            {
                test: /\.ts$/,
                loader: process.env.IONIC_WEBPACK_LOADER
            },
            {
                test: /\.js$/,
                loader: process.env.IONIC_WEBPACK_TRANSPILE_LOADER
            }
        ]
    },

    plugins: [
        ionicWebpackFactory.getIonicEnvironmentPlugin(),
        ionicWebpackFactory.getCommonChunksPlugin(),
        new webpack.DefinePlugin({
            ENV: JSON.stringify(envVars)
        })
    ].concat(prodPlugins),

    // Some libraries import Node modules but don't use them in the browser.
    // Tell Webpack to provide empty mocks for them so importing them works.
    node: {
        fs: 'empty',
        net: 'empty',
        tls: 'empty'
    }
};
$ ionic info

cli packages: (D:\Desenvolvimento\xampp\htdocs\reciklado\node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.6.0

System:

    Node : v6.11.2
    npm  : 5.3.0
    OS   : Windows 10


Same problem here :frowning: