99.10.0 • Published 4 years ago

@temporg/config-webpack v99.10.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

category: packages

config-webpack

npm  build-status  MIT License  Code of Conduct

A shared webpack config made by Rock Content

Installation

yarn add @temporg/config-webpack

Usage

In your Webpack config file:

/* webpack.config.js */
const baseConfig = require('@temporg/config-webpack')
module.exports = {
  ...baseConfig,
  plugins: [ ...baseConfig.plugins, ...myPlugins ],
  module: {
    // note: put your rules first
    rules: [ ...myModuleRules, ...baseConfig.module.rules ]
  },
  resolveLoader: {
    alias: { ...baseConfig.resolveLoader.alias, ...myLoaderAliases }
  }
}

Themeable Components

If your application already has a babel config and webpack config, and it is costly to convert fully to the shared webpack config, you can introduce themeable components incrementally by adding the appropriate loader and resolve loader to your existing webpack config.

/* webpack.config.js */
module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        exclude: [/node_modules/],
        use: [
          'babel-loader',
          'themeable-css-loader',
          'postcss-loader'
        ]
      }
    ]
  },
  resolveLoader: {
    alias: require('@temporg/config-webpack').resolveLoader.alias
  }
}