Options

You can put the options in a config file, and you can also override it from CLI flags: e.g. poi build --out-dir example/dist or set something to false: poi build --no-minimize.

CLI flags will be automatically camelCased.

Shared options

These options are shared in all commands.

entry

  • Type: stringstring[]object
  • Default: index.js
  • CLI override: poi [entry]

The entry file of your app.

outDir

  • Type: string
  • Default: dist
  • CLI flags: --out-dir-d

The output directory of bundled files.

cleanOutDir

  • Type: boolean
  • CLI flags: --clean-out-dir

Clean the output directory before bundling.

WARNING

We will always clean the output directory when output filename contains hash.

publicPath

  • Type: string
  • Default: /
  • CLI flags: --public-path

This option specifies the public URL of the output directory when referenced in a browser.

format

  • Type: string
  • Default: undefined
  • Possible values: cjsumd
  • CLI flags: --format

Bundle format, not set by default meaning it will be bundled in iife format.

babel

jsx

  • Type: string
  • Default: react
  • Possible values: reactvue or any JSX pragma like h for Preact et al.
  • CLI flags: --babel.jsx

Controlling how to transform JSX.

WARNING

This only works if you DON'T use a custom babel config file.

include

  • Type: string[]
  • Default: undefined

Transpile certain modules with Babel.

css

extract

  • Type: boolean
  • Default: true in poi build, false otherwise.

Extract CSS into standalone files.

modules

  • Type: boolean
  • Default: false

Enable CSS modules for all CSS files.

TIP

CSS modules are enabled by default for .module.css etc.

moduleName

  • Type: string
  • Default: undefined
  • CLI flags: --module-name

When you're bundling in umd format, you need to set module name so that your library can be accessed via window.YOUR_MODULE_NAME.

env

  • Type: boolean
  • Default: true
  • CLI flags: --env
  • CLI only: ✅

Load .env file from current working directory.

define

  • Type: object
  • Default: undefined

Define global constants which can be configured at compile time.

Please refer to relevant webpack docs for more usage of this.

sourceMap

  • Type: booleanstring
  • Default: source-map in poi build, inline-source-map in poi test, eval-source-map otherwise.
  • Possible values: any devtool.
  • CLI flags: --source-map

Disable or use custom sourcemap type.

minimize

  • Type: boolean
  • Default: true in poi build, false otherwise
  • CLI flags: --minimize

Minimize bundled code.

filename

js

  • Type: string
  • Default: [name].[chunkhash:8].js in poi build, [name].js otherwise.
  • CLI flags: --filename.js

Output filename for .js files.

css

  • Type: string
  • Default: [name].[chunkhash:8].css in poi build, [name].css otherwise.
  • CLI flags: --filename.css

Output filename for .css files.

chunk

  • Type: string
  • Default: [name].[chunkhash:8].js in poi build, [name].js otherwise.
  • CLI flags: --filename.chunk

Output filename for lazy-loaded chunk files.

font

  • Type: string
  • Default: assets/fonts/[name].[hash:8].[ext] in poi build, assets/fonts/[name].[ext] otherwise.
  • CLI flags: --filename.font

Output filename for font files.

image

  • Type: string
  • Default: assets/images/[name].[hash:8].[ext]
  • CLI flags: --filename.image

Output filename for image files.

staticFolder

  • Type: string
  • Default: static

The path to static folder, which will be copied to the root of output directory.

e.g. ./static/favicon.ico will be copied to ./dist/favicon.ico.

copy

Copy static files to the root of output directory.

vue

fullBuild

  • Type: boolean
  • Default: false

Use Runtime + Compile build of Vue.js,

loaderOptions

  • Type: objectloaderOptions => newLoaderOptions

Merge this object with default options of vue-loader using lodash.merge.

html

Options for html-webpack-plugin.

  • Default:

(pkg is the data of your package.json)

{
  // Default to `pkg.title` or directory name
  title,
  // Default to `pkg.description`
  description,
  // The environment variables you defined
  env,
  // Entire `pkg`
  pkg
}

You can access these options in template file via htmlWebpackPlugin.options.

Dev options

These options are only for poi and poi develop.

host

  • Type: string
  • Default: process.env.HOST || '0.0.0.0'

Host for development server.

port

  • Type: numberstring
  • Default: process.env.PORT || 4000

Port for development server.

devServer

Options for webpack-dev-server.

hotReload

  • Type: boolean
  • Default: true in poi and poi develop, false otherwise

Toggle HMR.

hotEntry

  • Type: stringstring[]
  • Default: main

Add HMR client to specific entries.

restartOnFileChanges

  • Type: stringstring[]

Restart the Poi process when specific files are modified.

TIP

We always watch Poi config file unless this option is set to false.

Build options

These options are only for poi build.

hash

  • Type: boolean
  • Default: true

Toggle hash in filename.