Skip to content

Conversation

@TristanWatanabe
Copy link
Member

@TristanWatanabe TristanWatanabe commented Mar 9, 2023

Changes:

  • updates migrate-converged-pkg workspace generator to add a node field within v9 package's export maps to address issue where native ESM doesn't work in a node environment.

Issue and Solution Story:

Before:

See test.mjs file below which uses ESM import syntax:

//test.mjs file
import { getSlots } from '@fluentui/react-utilities';

// eslint-disable-next-line no-console
console.log(getSlots);

Running node test.mjs in the terminal results in error below:

image

After:

Adding node to the package.json's exports map which points to the commonjs output fixes this:

  // @fluentui/react-utilities package.json file
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "node": "./lib-commonjs/index.js",
      "import": "./lib/index.js",
      "require": "./lib-commonjs/index.js"
    },

Now when running node test.mjs in the terminal, expected result is outputted:

image

Related Issue(s)

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 9, 2023

📊 Bundle size report

🤖 This report was generated against fb646c66eea6c3b0634108dd1c7c66a0159584b3

@size-auditor
Copy link

size-auditor bot commented Mar 9, 2023

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: fb646c66eea6c3b0634108dd1c7c66a0159584b3 (build)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a3c0cbb:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@github-actions github-actions bot added this to the March Project Cycle Q1 2023 milestone Mar 9, 2023
@TristanWatanabe TristanWatanabe merged commit 71b0088 into microsoft:master Mar 15, 2023
@TristanWatanabe TristanWatanabe deleted the add-node-field-to-export-map branch March 15, 2023 17:42
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Mar 15, 2023
* master: (141 commits)
  chore: prerequisite changes before migrating v9 packages to SWC based transpilation (microsoft#26965)
  feat: Add InfoLabel component (microsoft#27118)
  fix(tools): update migrate-converged generator to add node field to package.json exports map (microsoft#27152)
  applying package updates
  fix: Embed play/pause indicator should render correctly in high contrast mode (microsoft#27213)
  feat(tokens): Add colorNeutralBackgroundAlpha and colorNeutralStrokeAlpha tokens (microsoft#27034)
  chore: Prepare release 0.66.4 (microsoft#27163)
  fix(react-datepicker-compat): Fix text entry issues with input (microsoft#27204)
  fix: Smooth out animation of indeterminate progress bar (microsoft#27201)
  Add cxe-red as a codeowner of react-file-type-icons (microsoft#27147)
  Added documentation about custom style hooks (microsoft#27087)
  Custom style react-text (microsoft#27078)
  Custom style react-image (microsoft#27066)
  Add JSDoc for tabster focus indicator selector (microsoft#27041)
  Theme designer: Move colors to local files (microsoft#27191)
  docs(react-card): move card out of preview (microsoft#27185)
  Include values in typography table (microsoft#27189)
  feat: accept a className in `mountNode` in `Portal` (microsoft#27008)
  RFC: Extend `mountNode` prop in `Portal` (microsoft#27009)
  applying package updates
  ...
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Mar 15, 2023
* master: (141 commits)
  chore: prerequisite changes before migrating v9 packages to SWC based transpilation (microsoft#26965)
  feat: Add InfoLabel component (microsoft#27118)
  fix(tools): update migrate-converged generator to add node field to package.json exports map (microsoft#27152)
  applying package updates
  fix: Embed play/pause indicator should render correctly in high contrast mode (microsoft#27213)
  feat(tokens): Add colorNeutralBackgroundAlpha and colorNeutralStrokeAlpha tokens (microsoft#27034)
  chore: Prepare release 0.66.4 (microsoft#27163)
  fix(react-datepicker-compat): Fix text entry issues with input (microsoft#27204)
  fix: Smooth out animation of indeterminate progress bar (microsoft#27201)
  Add cxe-red as a codeowner of react-file-type-icons (microsoft#27147)
  Added documentation about custom style hooks (microsoft#27087)
  Custom style react-text (microsoft#27078)
  Custom style react-image (microsoft#27066)
  Add JSDoc for tabster focus indicator selector (microsoft#27041)
  Theme designer: Move colors to local files (microsoft#27191)
  docs(react-card): move card out of preview (microsoft#27185)
  Include values in typography table (microsoft#27189)
  feat: accept a className in `mountNode` in `Portal` (microsoft#27008)
  RFC: Extend `mountNode` prop in `Portal` (microsoft#27009)
  applying package updates
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants