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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
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
Existing Behavior in Production (and dev) Bundler v7
New Behavior With This Change
Types of changes
Check boxes that apply:
Checklist
Check boxes that apply: