Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Webpack configuration #221

Closed
sapegin opened this issue Nov 11, 2016 · 0 comments
Closed

Simplify Webpack configuration #221

sapegin opened this issue Nov 11, 2016 · 0 comments
Milestone

Comments

@sapegin
Copy link
Member

sapegin commented Nov 11, 2016

Something like this:

webpackConfig: {
  resolve: {
    extensions: ['.scss'],
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: [dir],
        loaders: ['babel'],
      },
      {
        test: /\.scss$/,
        include: [dir],
        loaders: ['style', 'css', 'sass?precision=10'],
      },
    ],
  },
  postcss: () => ([
    autoprefixer,
  ]),
},

Or:

webpackConfig: env => { /* ... */ },

Also easier to reuse project’s config:

const _ = require('lodash');
const webpackConfig = require('webpack.config.js');
module.exports = {
  title: 'React Style Guide Example',
  components: 'lib/components/**/[A-Z]*.js',
  webpackConfig: _.pick(webpackConfig, ['resolve', 'module', 'postcss']),
};

With the current updateWebpackConfig option it’s too easy to accidentally overwrite options required for Styleguidist itself and spend a lot of time debugging (like #214).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant