Changes
- Upgrade all dependencies and ensure the loader works with
webpack>=4
and css-loader>=0.28.11
- Remove babel build - make the loader compatible with Node 8+ without additional build steps.
- Change the loader from being a drop-in replacement of
css-loader
to be used alongside css-loader
.
- Remove
orderAlphabetically
options - the output keys are sorted by default
- Remove
namedExport
and camelCase
options. Generated type definition files now have default export and can both export locals
and support dashes in property names out of box. Example:
export interface IMyComponentScss {
"some-class": string;
someOtherClass: string;
"some-class-sayWhat": string;
}
export const locals: IExampleCss;
export default locals;
- Use the built-in webpack logger to report errors. Remove the
silent
options because it becomes redundant
- Add a new
formatter
option to allow formatting the generated files with prettier
. That should solve the eol
issues and apply consistent code style with other files in the code base.
Upgrade guide:
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "@teamsupercell/typings-for-css-modules-loader",
options: {
// pass all the options for `css-loader` to `css-loader`, eg.
- namedExport: true
}
},
+ {
+ loader: "css-loader",
+ options: {
+ namedExport: true
+ }
+ },
]
}
]
}
};
- ensure all the typescript files import styles as default
- import * as styles from './styles.css';
+ import styles from './styles.css';
- add
allowSyntheticDefaultImports
TypeScript compiler option if there are type errors related to default imports