Skip to content

Conversation

@Obi-Dann
Copy link
Contributor

@Obi-Dann Obi-Dann commented Aug 7, 2019

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:

  • 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

@Obi-Dann Obi-Dann force-pushed the UpgradeAllTheThings branch 7 times, most recently from 062d1d7 to a99531c Compare August 14, 2019 11:58
@Obi-Dann Obi-Dann changed the title WIP Changes for v2.0.0 Aug 14, 2019
@Obi-Dann Obi-Dann marked this pull request as ready for review August 14, 2019 11:59
@Obi-Dann Obi-Dann force-pushed the UpgradeAllTheThings branch from a99531c to 57479f7 Compare August 14, 2019 12:22
@Obi-Dann Obi-Dann merged commit 56b60f5 into master Aug 14, 2019
@Obi-Dann Obi-Dann deleted the UpgradeAllTheThings branch August 14, 2019 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants