Skip to content

Conversation

@BennieCopeland
Copy link

Fixes an issue with the icons being bundled using only CommonJS modules and ignoring ES Modules entirely.

This is due to the ofImport statements pointing to the CommonJS versions of the icons located in the @material-ui/icons directory. The current method of import:

let inline accessAlarmIcon b : ReactElement = 
  ofImport "default" "@material-ui/icons/AccessAlarm" (keyValueList CaseRules.LowerFirst b) []

creates an import statement of:

import AccessAlarm from "@material-ui/icons/AccessAlarm";

which is also the same path as the CommonJS @material-ui/icons/AccessAlarm.js. This prevents the bundler from locating the ES Module versions in @material-ui/icons/esm.

The new method dispenses with the use of "default":

let inline accessAlarmIcon b : ReactElement = 
  ofImport "AccessAlarm" "@material-ui/icons" (keyValueList CaseRules.LowerFirst b) []

and creates an import statement of:

import { AccessAlarm } from "@material-ui/icons";

and this allows the bundler to choose between the CommonJS and ESM module versions.

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.

1 participant