# 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.

TIP

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.

# generateStandalone

  • Type: boolean

  • Default: true

Generates a standalone version of your application in the dist/standalone folder that includes tree-shaken dependencies.

# 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.