@constgen/neutrino-mode

1.9.2 • Public • Published

@constgen/neutrino-mode

npm npm

Neutrino middleware to automatically choose the building mode (production or development) based on CLI command. It allows to pass less flags when run webpack or webpack-dev-server

Requirements

  • Node.js v10+
  • Neutrino v9
  • Webpack v4

Installation

@constgen/neutrino-mode can be installed from NPM. You should install it to "dependencies" (--save) or "devDependncies" (--save-dev) depending on your goal.

npm install --save @constgen/neutrino-mode

Usage

Important: If you use this middleware, you should use it at the very beginning before any other middlewares as it correctly defines process.env.NODE_ENV and neutrino.config.mode()

These commands will enable development mode and watching. So it is recommended to use one of them in package.json scripts.start:

webpack-dev-server
webpack --mode development

All other commands will be production. So it is recommended to use one of them in package.json scripts.build:

webpack
webpack --mode production

In preset

Require this package and plug it into Neutrino. The middleware has no options:

let mode = require('@constgen/neutrino-mode')

neutrino.use(mode())

In neutrinorc

The middleware also may be used together with another presets in Neutrino rc-file, e.g.:

.neutrinorc.js

let mode = require('@constgen/neutrino-mode')

module.exports = {
   use: [
      mode()
   ]
}

Package Sidebar

Install

npm i @constgen/neutrino-mode

Weekly Downloads

4

Version

1.9.2

License

GPL-3.0

Unpacked Size

38.4 kB

Total Files

4

Last publish

Collaborators

  • constgen