Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

fix(load-styles): export css module classes as-is #638

Merged
merged 3 commits into from
May 3, 2024

Conversation

zacowan
Copy link
Member

@zacowan zacowan commented Apr 22, 2024

Description

Note: this reverts an unintentional breaking change introduced with v7 of the one app bundler.

Updates load-styles to map css module class names using an "as-is" strategy, rather than a "camelCaseOnly" strategy in order to match the behavior of the webpack-based styles loader in @americanexpress/one-app-bundler@6. To be fully backwards-compatible with the webpack implementation, the exports needed to be changed to cjs-style exports.

Motivation

In switching over to load-styles provided by the dev bundler with the release of @americanexpress/one-app-bundler@7, an unintentional breaking change was introduced to the way that css module classes were mapped and exported when loading the styles. The webpack-based styles loader exported classes "as-is", while the esbuild-based styles loader exported classes in "camelCaseOnly". Additionally, the webpack delivered exports using cjs-style exports, rather than esm-style exports.

Test Conditions

Added unit tests for the most common ways people would define classes in css modules. Additionally, validated the changes in a test module.

Behavior in Production Bundler v6

Screenshot 2024-04-18 at 10 05 29 AM

Existing Behavior in Production (and dev) Bundler v7

Screenshot 2024-04-22 at 5 00 07 PM

New Behavior With This Change

Screenshot 2024-04-23 at 9 58 42 AM

Screenshot 2024-04-23 at 10 05 50 AM

Types of changes

Check boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update
  • Security update

Checklist

Check boxes that apply:

  • My code follows the code style of this project.
  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • These changes should be applied to a maintenance branch.
  • I have added the Apache 2.0 license header to any new files created.

@zacowan zacowan marked this pull request as ready for review April 23, 2024 15:32
@zacowan zacowan requested review from a team as code owners April 23, 2024 15:32
@code-forger
Copy link
Member

This will need backporting too please

@code-forger code-forger requested a review from a team April 24, 2024 09:15
@zacowan zacowan merged commit c71d825 into main May 3, 2024
5 checks passed
@zacowan zacowan deleted the fix/css-module-class-name-case branch May 3, 2024 15:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants