Zante can be configured like babel and eslint using plugins and presets.

Support .zanterc/.zanterc.js/.zanterc.json

The default .zantrc.js file:

module.exports = {
  entry: {
    app: './src/app.js'
  },
  plugins: [
    'es',
    'eslint',
    'css',
    'assets'
  ],
  env: {
    production: {
      output: {
        publicPath: 'http://xxx.cdn.com'
      },
      plugins: [
        'production',        
        'optimize',
        'commonchunk',
        'html'
      ]
    },
    development: {
      plugins: [
        'development',
        'dll',
        [
          'html',
          [{
            filename: 'index.html',
            dll: true
          }]
        ],
        'static',
        [
          'proxy',
          {
            api: 'http://mock-server.com'
          }
        ]
      ]
    }
  }
}

plugins

One plugin provide one ability, such as `zante-plugin-es` plugin handles js an jsx file.

Plugin can update webpack config and add some scripts after webpack config compiled.

Plugin Function

const plugin = ({webpackConfig, scripts, userConfig}) => {
    // do something with webpackConfig, such as push rules or plugins
    webpackConfig.module.rules.push({
      test: /\.jsx?$/,
      use: ['babel-loader']
    })

    // add scripts, server is an express app
    scripts.push(({webpackConfig, server, compiler}) => {
      server.use('/plugin', (req, res) => {
        res.send('this is plugin')
      })
    })
    return { webpackConfig, scripts }
}

Resolve

type dealing
string load `zante-plugin-${name}` package
function just use function

env

In different environment, there can be different plugins and webpack config. env name is determined by `process.env.NODE_ENV`

source

Specify the default source folder, default is src

port

Specify server port, default is 9000

others

You can specify any webpack config except plugins in rc or rc[env], the config will be merged.

results matching ""

    No results matching ""