# Configuration Reference

# Global Configuration

Some configuration is globally stored in a .nodepackrc JSON file in your home directory. It also contains saved presets and permanent options for error diagnostics.

You can edit this file with your favorite code editor and save it in place.

# nodepack.config.js

Nodepack is configured through the nodepack.config.js file in the root directory of your project. It should export an object with the available options:

module.exports = {
  // Configure your project here

If you use a typescript-enabled IDE (like Visual Studio Code), you can get type autocompletion with this JSDoc comment:

/** @type {import('@nodepack/service').ProjectOptions} */
module.exports = {
  // Typings will be available here!

# outputDir

  • Type: string

  • Default: ./dist

The folder where the built files will be written when running nodepack-service build.


Before each compilation, the folder will be removed. You can disable this behavior with --no-clean.

# entry

  • Type: string

  • Default: src/index.js

Entry file (relative to project root).

# defaultPort

  • Type: number

  • Default: 4000

Default port for process.env.PORT if it is not defined.

It will change to a free port automatically if it is not available. See Automatic Port for more details.

# minify

  • Type: boolean

  • Default: false

Enable minification of the built files in production mode.

# parallel

  • Type: boolean

  • Default: true if your computer has multiple cores

Enable parallel compilation over multiple cores.

# productionSourceMap

  • Type: boolean

  • Default: false

Enable Source Maps in production mode.

# externals

  • Type: boolean|Array.<string>|string

  • Default: false

Modules and packages marked as external are not bundled into the built files.

If false, nothing is marked as external.

In case you don't want the dependencies to be built into the final output, you should set this option to true, which will let Nodepack figureout which module should be external (for example modules in node_modules folder). You can further customize this with the nodeExternalsWhitelist option.

If a string or an array of strings, only those specific modules will be external.

# nodeExternalsWhitelist

  • Type: Array.<string | RegExp>|function

  • Default: whitelists assets like .css, .png, .svg...

If externals is true, webpack-node-externals is used to determinate which module should be marked as external. See whitelist option for more details.

# defineEnv

  • Type: Array.<string>

List of environment variable names to replace during compilation. For example: ['DB_NAME', 'DB_USER', 'DB_PASSWORD'].

# chainWebpack

  • Type: function

Use webpack-chain to customize the final Webpack configuration.

See Working with Webpack for more details.

# pluginOptions

  • Type: any

Options for third-party plugins.