0.0.1 • Published 4 years ago

@temporg/ui-webpack-config v0.0.1

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

category: packages

ui-webpack-config

npm  build-status  MIT License  Code of Conduct

A shared webpack config made by Rock Content.

Installation

yarn add @temporg/ui-webpack-config

Usage

In your Webpack config file:

/* webpack.config.js */
const baseConfig = require('@temporg/ui-webpack-config')
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/ui-webpack-config').resolveLoader.alias
  }
}