define-env-plugin
Enable client code to get node variables
Installation
yarn add define-env-plugin -D
Usage
// webpack.config.js const DefineEnvPlugin = ; moduleexports = plugins: // 'APP_VERSION' 'AUTHOR' ;
In client code use it
// main.js// process.env can get the fields in the scripts of package.js console;
Options
NODE_ENV and SERVICE_URL are built in by default, You can pass in other fields
Available options are:
NODE_ENV (string): environment for browser.
SERVICE_URL (string): http url for api.
SOCKET_URL (string): websocket url for api.