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: rollup bundles don't resolve fast-element utilities #6070

Closed
radium-v opened this issue Jun 6, 2022 · 5 comments · Fixed by #6467
Closed

fix: rollup bundles don't resolve fast-element utilities #6070

radium-v opened this issue Jun 6, 2022 · 5 comments · Fixed by #6467
Assignees
Labels
area:fast-element Pertains to fast-element improvement A non-feature-adding improvement status:planned Work is planned

Comments

@radium-v
Copy link
Collaborator

radium-v commented Jun 6, 2022

🐛 Bug Report

It seems that Rollup doesn't support the use of the exports field in package.json.

Probably related:

🤔 Expected Behavior

Rollup should be able to resolve and handle imports from @microsoft/fast-element/utilities.

😯 Current Behavior

An error is present when running build:rollup in @microsoft/fast-foundation (other packages which use Rollup may also be affected):

(!) Plugin typescript: @rollup/plugin-typescript TS2307: Cannot find module '@microsoft/fast-element/utilities' or its corresponding type declarations.
src/design-token/design-token.ts: (13:50)

13 import { composedContains, composedParent } from "@microsoft/fast-element/utilities";
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.ts: (68:50)

68 export { composedParent, composedContains } from "@microsoft/fast-element/utilities";
  

💁 Possible Solution

We could divert the Rollup builds to use the already-built dist files (generated by build:tsc before rollup runs) until Rollup receives proper exports support.

@radium-v radium-v added the status:triage New Issue - needs triage label Jun 6, 2022
@EisenbergEffect
Copy link
Contributor

I think it technically builds the bundle correctly..but yeah there's some sort of issue with Rollup not handling this right. It might be worth us contributing to rollup to fix this so that customers don't get confused/frustrated. I'm not sure if they've got an issue open or not yet.

@EisenbergEffect
Copy link
Contributor

Oh, I see you linked the issues above 😝

@EisenbergEffect EisenbergEffect added improvement A non-feature-adding improvement status:planned Work is planned area:fast-element Pertains to fast-element and removed status:triage New Issue - needs triage labels Jun 10, 2022
@EisenbergEffect EisenbergEffect added this to the FAST Element 2.0 milestone Jun 10, 2022
@tebinraouf
Copy link
Contributor

It's probably related to this so I'd leave the comment here instead of creating a new issue. While testing the FAST Foundation components v3.0.0-alpha.15, I get the following error:

> fast-alpha-angular@0.0.0 start
> ng serve

✔ Browser application bundle generation complete.

Initial Chunk Files   | Names         |  Raw Size
vendor.js             | vendor        |   1.92 MB | 
polyfills.js          | polyfills     | 318.03 kB | 
styles.css, styles.js | styles        | 210.10 kB | 
main.js               | main          |  47.96 kB | 
runtime.js            | runtime       |   6.53 kB | 

                      | Initial Total |   2.49 MB

Build at: 2022-10-07T03:07:02.956Z - Hash: fa73df67e6f62584 - Time: 4465ms

Error: node_modules/@microsoft/fast-foundation/dist/dts/index.d.ts:50:50 - error TS2307: Cannot find module '@microsoft/fast-element/utilities' or its corresponding type declarations.

50 export { composedParent, composedContains } from "@microsoft/fast-element/utilities";
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


✖ Failed to compile.

Here is a sample Angular project to show the error:
https://github.com/tebinraouf/fast-alpha-angular-project

I do see there is a TODO to remove it and when I do so, it works as expected. Wondering when we can remove?
https://github.com/microsoft/fast/blob/master/packages/web-components/fast-foundation/src/index.ts#L53-L54

@EisenbergEffect
Copy link
Contributor

I forgot about this one. @janechu Do you know if we still need this for the CLI?

@janechu
Copy link
Collaborator

janechu commented Oct 19, 2022

This is not needed by the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:fast-element Pertains to fast-element improvement A non-feature-adding improvement status:planned Work is planned
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants