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

fix(web-components): Fixed pathing to types for package exports #28986

Conversation

mohamedmansour
Copy link
Contributor

@mohamedmansour mohamedmansour commented Aug 25, 2023

Previous Behavior

When typechecking a project that uses package exports, it is throwing an error:

src/browser-essentials.ts:3:26 - error TS7016: Could not find a declaration file for module '@fluentui/web-components-v3/theme.js'.
  
 import { setTheme } from '@fluentui/web-components-v3/theme.js';
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

New Behavior

The DTS should be correctly resolved since the package exports is pointing to the right one.

@mohamedmansour mohamedmansour requested a review from a team as a code owner August 25, 2023 04:02
@fabricteam
Copy link
Collaborator

fabricteam commented Aug 25, 2023

📊 Bundle size report

🤖 This report was generated against 36ec4911bd318b6b59c2a0537611422c0f0a2e2e

@mohamedmansour
Copy link
Contributor Author

Hey @chrisdholt I never submitted a PR here, so I don't know what to do. When I build locally I am getting

ERR! [!] Error: While loading the Rollup configuration from "rollup.config.js", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.
ERR! https://rollupjs.org/guide/en/#using-untranspiled-config-files
ERR! Error: While loading the Rollup configuration from "rollup.config.js", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.
ERR!     at Object.error (c:\Code\fluentui\node_modules\rollup\dist\shared\rollup.js:198:30)
ERR!     at loadConfigFromBundledFile (c:\Code\fluentui\node_modules\rollup\dist\shared\loadConfigFile.js:630:27)
ERR!     at loadConfigFile (c:\Code\fluentui\node_modules\rollup\dist\shared\loadConfigFile.js:565:11)
ERR!     at Object.loadAndParseConfigFile (c:\Code\fluentui\node_modules\rollup\dist\shared\loadConfigFile.js:545:21)
ERR!     at getConfigs (c:\Code\fluentui\node_modules\rollup\dist\bin\rollup:1691:39)
ERR!     at runRollup (c:\Code\fluentui\node_modules\rollup\dist\bin\rollup:1665:43)
ERR!
ERR! npm ERR! Lifecycle script `build` failed with error:
ERR! npm ERR! Error: command failed
ERR! npm ERR!   in workspace: @fluentui/web-components@3.0.0-beta.0
ERR! npm ERR!   at location: c:\Code\fluentui\packages\web-components

@fabricteam
Copy link
Collaborator

fabricteam commented Aug 25, 2023

🕵 fluentui-web-components-v3 No visual regressions between this PR and main

@size-auditor
Copy link

size-auditor bot commented Aug 25, 2023

Asset size changes

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

Baseline commit: 36ec4911bd318b6b59c2a0537611422c0f0a2e2e (build)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 25, 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 9cb448d:

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

@mohamedmansour mohamedmansour force-pushed the user/mmansour/fix-web-components branch from aa9831c to d8705b8 Compare August 25, 2023 18:16
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.
@mohamedmansour mohamedmansour force-pushed the user/mmansour/fix-web-components branch from d8705b8 to bf23274 Compare August 25, 2023 18:18
@mohamedmansour mohamedmansour changed the title [web-components] Point to the correct typings for package exports fix(web-components): Fixed pathing to types for package exports Aug 25, 2023
Copy link
Member

@chrisdholt chrisdholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/Paste is a killer - thanks for this fix @mohamedmansour!

@chrisdholt chrisdholt merged commit 9d4c07c into microsoft:web-components-v3 Aug 25, 2023
18 checks passed
@mohamedmansour mohamedmansour deleted the user/mmansour/fix-web-components branch August 26, 2023 15:04
chrisdholt added a commit that referenced this pull request Apr 29, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
…osoft#28986)

Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
…osoft#28986)

Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 30, 2024
…osoft#28986)

Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request Apr 30, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 2, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 2, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 2, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 3, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 6, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 6, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 8, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
radium-v pushed a commit that referenced this pull request May 10, 2024
Running typescript typechecking threw an error that it cannot find
the type for the import defined in the package exports. This change
updates package.json to point to the right location, dts folder,
instead of esm folder.

Co-authored-by: Chris Holt <chhol@microsoft.com>
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.

3 participants