Skip to content

Commit

Permalink
Remove unnescessary advice
Browse files Browse the repository at this point in the history
AFAIK these PR's are merged. I am running with Webpack 2 + styled components with no problem using the ES2015 preset.
  • Loading branch information
greenimpala authored Mar 1, 2017
1 parent 6c0b8aa commit 7905838
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
# FAQ

### Using styled-components with webpack 2

If you're using `styled-components` with webpack 2 and you use the babel-loader you need to turn off `babel-plugin-transform-es2015-modules-commonjs`. You can do this with a configuration object passed to the es2015 or latest preset.

For `babel-preset-es2015`:
```JS
presets: [
['es2015', {
modules: false
}]
]
```

For `babel-preset-latest`:
```JS
presets: [
['latest': {
es2015: {
modules: false
}
}]
]
```

If you can't do this for whatever reason you have to hint webpack to load the commonjs bundle of `style-components`. You can do this by adding this to your webpack configuration:

```JS
alias: {
// Use styled-components commonjs bundle instead of the es modules bundle
'styled-components$': 'styled-components/lib/index.js',
}
```

In a future version of webpack this bug should be fixed. See [issue#115](https://github.com/styled-components/styled-components/issues/115), [issue#157](https://github.com/styled-components/styled-components/issues/157) and [webpack-issue#3168](https://github.com/webpack/webpack/issues/3168) for further information.

### My styles are being repeated multiple times

You might notice that generating styles based on dynamic props will result in repeated CSS declarations. In other words, in the following example:
Expand Down

0 comments on commit 7905838

Please sign in to comment.