text: const path = require("path")
  const merge = require("webpack-merge")
  const parts = require("./webpack.parts")
  
  const PATHS = {
    app: path.join(__dirname, "lib"),
    build: path.join(__dirname, "build"),
  }
  
  const commonConfig = merge([
    parts.entry(),
    parts.output(),
    parts.plugins(),
    parts.loadJavaScript({ include: PATHS.app }),
  ])
  
  const productionConfig = merge([
    parts.clean(PATHS.build),
    parts.attachRevision(),
    parts.minifyJavaScript(),
  ])
  
  const developmentConfig = merge([
    parts.devServer({
      host: process.env.HOST,
      port: process.env.PORT,
    }),
  ])
  
  module.exports = mode => {
    if (mode === "production") {
      return merge(commonConfig, productionConfig, { mode })
    }
  
    return merge(commonConfig, developmentConfig, { mode })
  }
  