Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and fix issue with ofImport #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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