Skip to content

Commit 0c03f83

Browse files
committed
Add instructions upgrading from v1 to the readme
1 parent c8141b3 commit 0c03f83

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,47 @@ console.log(locals.someOtherClass);
179179

180180
![typed-css-modules](https://cloud.githubusercontent.com/assets/749171/16340497/c1cb6888-3a28-11e6-919b-f2f51a282bba.gif)
181181

182+
## Upgrade from v1:
183+
- Update webpack config
184+
- This package no longer replaces `css-loader`, but it has to be added alongside `css-loader`:
185+
- `css-loader` is no longer a peer dependency due to the change above
186+
- `css-loader` will need to be configured to output CSS Modules (e.g. `options: { modules: true; }`)
187+
```diff
188+
module.exports = {
189+
module: {
190+
rules: [
191+
{
192+
test: /\.css$/i,
193+
use: [
194+
"style-loader",
195+
{
196+
loader: "@teamsupercell/typings-for-css-modules-loader",
197+
options: {
198+
// pass all the options for `css-loader` to `css-loader`, eg.
199+
- namedExport: true,
200+
- modules: true
201+
}
202+
},
203+
+ {
204+
+ loader: "css-loader",
205+
+ options: {
206+
+ namedExport: true,
207+
+ modules: true
208+
+ }
209+
+ },
210+
]
211+
}
212+
]
213+
}
214+
};
215+
```
216+
- Ensure all the typescript files import styles as default
217+
```diff
218+
- import * as styles from './styles.css';
219+
+ import styles from './styles.css';
220+
```
221+
- Add `allowSyntheticDefaultImports` TypeScript compiler option if there are type errors related to default imports
222+
182223
## Support
183224

184225
As the loader just acts as an intermediary it can handle all kind of css preprocessors (`sass`, `scss`, `stylus`, `less`, ...).

0 commit comments

Comments
 (0)