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

API extractor prevents usage of re-exports 💥 #20694

Open
layershifter opened this issue Nov 22, 2021 · 23 comments
Open

API extractor prevents usage of re-exports 💥 #20694

layershifter opened this issue Nov 22, 2021 · 23 comments
Labels
Area: Build System Fluent UI react-components (v9) Resolution: Soft Close Soft closing inactive issues over a certain period Status: Blocked Resolution blocked by another issue

Comments

@layershifter
Copy link
Member

layershifter commented Nov 22, 2021

In I am trying to re-export functions in #20628:

// 🚨 breaks build
export * as shorthands from './shorthands/index';

But it's impossible, see #18906. I modified code to use import/export as suggested:

// 🚨 still breaks build
import * as shorthands from "./shorthands/index";
export { shorthands };

Error is similar to #19360, but it seems that problem is different as it breaks on @fluentuiu/react-make-styles that contains re-export:

ERR! [10:48:59 AM] ■ Extracting Public API surface from 'packages\react-make-styles\lib\index.d.ts'
ERR! Analysis will use the bundled TypeScript version 4.1.5
ERR! [10:48:59 AM] x Error detected while running '_wrapFunction'
ERR! [10:48:59 AM] x ------------------------------------
ERR! [10:49:00 AM] x Error: Internal Error: The ""packages/make-styles/lib/shorthands/index"" symbol has a ts.SyntaxKind.SourceFile declaration which is not (yet?) supported by API Extractor
ERR!
ERR! You have encountered a software defect. Please consider reporting the issue to the maintainers of this
application.

Only code below passes build:

import { margin, padding } from "./shorthands/index";

export const shorthands = { margin, padding };

But it breaks tree shaking for bundlers as shorthands is an object now and any usage of shorthands.* will include all functions to bundle *.

  • * if Terser is not used, but it will be used in any setup

Rollup REPL.

@Hotell
Copy link
Contributor

Hotell commented Nov 22, 2021

Blocked by microsoft/rushstack#2780

@Hotell Hotell added the Status: Blocked Resolution blocked by another issue label Nov 22, 2021
@Hotell
Copy link
Contributor

Hotell commented Nov 22, 2021

not sure if rollup repl uses terser ( or any kind of mangler ) ? I tried terser REPL and it tree-shakes as expected

↓↓↓↓

https://try.terser.org/ ->
2021-11-22 at 15 37

@Hotell
Copy link
Contributor

Hotell commented Nov 22, 2021

@layershifter
Copy link
Member Author

layershifter commented Nov 22, 2021

not sure if rollup repl uses terser ( or any kind of mangler ) ? I tried terser REPL and it tree-shakes as expected

@Hotell it's not and you're right, with Terser on top it works. However, Webpack and Rollup are able to handle imports scenario without invoking Terser.

I updated the issue to clarify it.

@layershifter
Copy link
Member Author

Blocked by microsoft/rushstack#2780

Not sure if it's a relevant issue, for me this looks closer to the problem microsoft/rushstack#2842.

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label May 21, 2022
@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@layershifter layershifter reopened this Nov 22, 2022
@layershifter layershifter removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Jan 23, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution: Soft Close Soft closing inactive issues over a certain period labels Aug 25, 2023
@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

3 similar comments
@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

6 similar comments
@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@layershifter layershifter reopened this Aug 28, 2023
@layershifter layershifter removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Aug 28, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Feb 25, 2024

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@chrisdholt
Copy link
Member

Reopening as the Web Components have this issue still as well.

@chrisdholt chrisdholt reopened this Apr 24, 2024
@Hotell
Copy link
Contributor

Hotell commented Aug 13, 2024

seems this fix landed in api-extractor - we need to bump to latest version ( after/with migration to particular typescript version ),

follows #31857

UPDATE:

This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes.
Still require assistance? Please add comment - "keep open".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Build System Fluent UI react-components (v9) Resolution: Soft Close Soft closing inactive issues over a certain period Status: Blocked Resolution blocked by another issue
Projects
None yet
Development

No branches or pull requests

4 participants