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

[Bug]: PCF build error pragma and pragmaFrag cannot be set when runtime is automatic. #29126

Closed
2 tasks done
MaTeMaTuK opened this issue Sep 11, 2023 · 7 comments · Fixed by #29145
Closed
2 tasks done
Labels
Fluent UI react-components (v9) Shield: P1 Shield developers rate the issue as a high priority (good issue) Status: In PR Type: Bug 🐛

Comments

@MaTeMaTuK
Copy link

MaTeMaTuK commented Sep 11, 2023

Library

React Components / v9 (@fluentui/react-components)

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 2.12 GB / 15.39 GB
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (116.0.1938.76)
    Internet Explorer: 11.0.19041.1566

Are you reporting Accessibility issue?

None

Reproduction

Create PCF component and install latest @fluentui/react-components, build

Bug Description

Library requires the latest React version and it conflicts with current PCF for D365 setup. Can you help with harmonization from here ?

Actual Behavior

\node_modules@fluentui\react-tree\lib\components\Tree\renderTree.js: pragma and pragmaFrag cannot be set when runtime is automatic.

1 | /** @jsxRuntime automatic / /* @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
| ^
2 | import { assertSlots } from '@fluentui/react-utilities';
3 | import { TreeProvider } from '../../contexts';
4 | export const renderTree_unstable = (state, contextValues)=>{;

Expected Behavior

Logs

No response

Requested priority

Blocking

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@layershifter
Copy link
Member

layershifter commented Sep 12, 2023

Are you compiling Fluent sources? I.e. is there a babel-loader or something that is triggered on node_modules/@fluentui/**?

Can you please provide a minimal reproduction case? On Stackblitz or a Github repo.

@MaTeMaTuK
Copy link
Author

Hi @layershifter,
I have prepared example

@anitu
Copy link

anitu commented Sep 12, 2023

I had the same issue. The pcf-scripts package replaced esbuild-loader with babel-loader in 1.26.5. I downgraded the package to 1.20.3 and the build was successful. Hope this helps.

@MissyM
Copy link

MissyM commented Sep 12, 2023

Hi @MaTeMaTuK. I solved it by extending the Webpack configuration.
In a webpack.config.js file, in the root of the project, add:

module.exports = { module: { rules: [ { test: /\.(js|ts|tsx)$/, loader: 'string-replace-loader', options: { search: '/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */', replace: '', } } ] } }
I took this idea to extend the Webpack from here

@MaTeMaTuK
Copy link
Author

MaTeMaTuK commented Sep 13, 2023

Hi @MissyM, Thank you for your help but I have the same error with this change
Capture1
Thanks @anitu, your option is working!

@layershifter layershifter added Type: Bug 🐛 Shield: P1 Shield developers rate the issue as a high priority (good issue) and removed Needs: Triage 🔍 labels Sep 14, 2023
@layershifter
Copy link
Member

Hi @layershifter,
I have prepared example

@MaTeMaTuK thanks for providing the example. In your case, babel-loader runs with @babel/preset-react on node_modules. TBH I don't think that it's correct config for Webpack, but anyway these comments should be stripped out on your side.

A simpler repro on Stackblitz: https://stackblitz.com/edit/stackblitz-starters-qn6rv5

@layershifter
Copy link
Member

The release just came to NPM, comments causing problems are no longer present 🐱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-components (v9) Shield: P1 Shield developers rate the issue as a high priority (good issue) Status: In PR Type: Bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants