0.1.5 • Published 4 years ago

define-env-plugin v0.1.5

Weekly downloads
35
License
MIT
Repository
github
Last release
4 years ago

define-env-plugin

Enable client code to get node variables

Installation

yarn add define-env-plugin -D

Usage

// webpack.config.js

const DefineEnvPlugin = require('define-env-plugin');

module.exports = {
  plugins: [
    // 
    new DefineEnvPlugin(['APP_VERSION', 'AUTHOR'])
  ]
};

In client code use it

// main.js
// process.env can get the fields in the scripts of package.js

console.log(process.env);

Options

NODE_ENV and SERVICE_URL are built in by default, You can pass in other fields

  DefineEnvPlugin(['APP_VERSION', 'AUTHOR'])

Available options are:

NODE_ENV (string): environment for browser.

SERVICE_URL (string): http url for api.

SOCKET_URL (string): websocket url for api.

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago