@manpacker/noden v1.10.0
Explain
Noden is a set of build engine based on webpack to build engine package. Entry file supported file extension js or ts Support for multi-portal file build, Files must be in the build root directory.
.manpackeric
Project default initialization file, Can be a javascript script file, or a json configuration file. Example: json
{"output": "bin"}You can also set the manpacker field in the package.json file. Example:
{"manpacker": {"root": "app"}}Final input result, Merge .manpackeric config item.
{"root": "app", "output": "bin"}You can customize the project initialization file name. Example: Custom name: development.ic.js
npx manpacker-noden --ci development.ic.jsmanpacker-noden --ci development.ic.jsInstall
npm i @manpacker/noden -DUsage
CLI
Start the local development environment.
manpacker-noden servermanpacker-noden server --ic [value] -c [config] --port [number]Construction of production environment engineering project.
manpacker-noden buildmanpacker-noden build --ic [value] -c [config]API
const noden = require('@manpacker/noden')method
.compile
Core compilation method
const { compile } = require('@manpacker/noden')
compile({ env, ic, config })| param | type | explain |
|---|---|---|
| env | string | env: NDOE_ENV variabl |
| ic | object | .manpackeric config item object |
| config | function | manpacker.noden.js return funtion |
.Commander
Commander is Create command-line class.
const { Commander } = require('@manpacker/noden')
let { version } = require('./package.json')
let commander = new Commander({ version })Explain commander methods
| method | explain |
|---|---|
| build | Default build production environment, enter project directory |
| server | Launch Development Environment, Local Interconnect Service, default Port 8090 |
| parse | Compile registration command Lint |
.createEslintLoader
Create Eslint loader generator.
| param | teype | explain |
|---|---|---|
| rgx | RegExp | Create eslint loader. |
.manpackeric
Default root file name: .manpackeric Configuration item description:
| name | type | value | description |
|---|---|---|---|
| root | string | default: app | Source directory for building the project |
| output | string | default: view | Directory output after build |
| define | object | dedalut: {NODE_ENV: process.env.NODE_ENV} | Define constants in a project, eslintrc set global key-value |
| isEslint | boolean | default: true | Start the eslint-loader feature by default |
| isExternalsDependencies | boolean | default: false | Build package dependency package |
manpacker.noden.js
Default root file name: manpacker.noden.js
module.exports = ic => {
// webpack config item.
return {}
}The parameter ic is the injected initialization parameter object. Webpack configuration items can be set based on ic