sp-dev-fx-controls-react icon indicating copy to clipboard operation
sp-dev-fx-controls-react copied to clipboard

Module not found - Wrong @fluentui imports cause webpack build errors

Open hohenp opened this issue 1 year ago • 8 comments

Category

[ ] Enhancement

[X ] Bug

[ ] Question

Version

Version: 3.17.0

Expected / Desired Behavior / Question

We are using the spfx-controls-react within a webpack project and would expect to build it without webpack errors.

Observed Behavior

We are using the spfx-controls-react within a webpack project. When we build the project we get several webpack errors like: image

Steps to Reproduce

We could identify the used imports of the @fluentui package to cause that issue: You are using for example the following import: import { ActionButton, PrimaryButton } from "@fluentui/react/lib/components/Button"; The correct import would be: import { PrimaryButton } from '@fluentui/react/lib/Button'; as described on the fluent ui page

You can also check the export section of the @fluentui package.json file. There for example the button is declared as

"./lib/Button": {
      "types": "./lib/Button.d.ts",
      "import": "./lib/Button.js",
      "require": "./lib-commonjs/Button.js"
    },

so without the /components/ section of the import you are using.

For testing we fixed the wrong imports in the following files and that fixed all build errors we got image

Could you please check all your imports of the @fluentui package?

Thanks Pascal

hohenp avatar Feb 13 '24 10:02 hohenp

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Feb 13 '24 10:02 ghost

Thank you for submitting your first issue to this project.

github-actions[bot] avatar Feb 13 '24 10:02 github-actions[bot]

Hello, could someone look into this?

hohenp avatar Mar 07 '24 08:03 hohenp

@hohenp many thanks for reporting this issue. Would you be interested in submitting a PR with the required changes?

joelfmrodrigues avatar Mar 14 '24 15:03 joelfmrodrigues

@joelfmrodrigues fix for the fluentui import are done and ready for review

raclettierer avatar Mar 19 '24 12:03 raclettierer

@AJIXuMuK wo will approve PRs ? we still waiting on this change.

raclettierer avatar Apr 09 '24 07:04 raclettierer

@hohenp the PR from @raclettierer is now merged. Would it be possible for you to test using the beta release please and let us know the outcome?

joelfmrodrigues avatar Apr 21 '24 10:04 joelfmrodrigues

Hi, I have tested the 3.18.0-beta.8771998 and can confirm that it works correct.

hohenp avatar Apr 22 '24 07:04 hohenp