This repository was archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
This repository was archived by the owner on Oct 30, 2020. It is now read-only.
typings-for-css-modules-loader 2.0 is now available (fork) #94
Copy link
Copy link
Open
Description
Hello everyone,
I forked typings-for-css-modules-loader
, applied some of the pull requests, made it compatible with css-loader >= 1 and simplified configuration options. You're very welcome to try it and provide any feedback.
https://github.com/TeamSupercell/typings-for-css-modules-loader
There's a list of changes
Changes
- Upgrade all dependencies and ensure the loader works with
webpack>=4
andcss-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 alongsidecss-loader
. - Remove
orderAlphabetically
options - the output keys are sorted by default - Remove
namedExport
andcamelCase
options. Generated type definition files now have default export and can both exportlocals
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 withprettier
. That should solve theeol
issues and apply consistent code style with other files in the code base.
Upgrade guide:
- Update webpack config
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
OwenDelahoy, waynecz, benkeen and mfpopaSaschaGalley, Ptival, mufasa71, atombender, desigens and 10 more
Metadata
Metadata
Assignees
Labels
No labels