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

chore: Vite Bundle Size Action Example Demonstrating Vite Errors with library #7970

Closed
wants to merge 4 commits into from

Conversation

ErikCH
Copy link

@ErikCH ErikCH commented Mar 19, 2021

This PR is demonstrate the errors with Vite when running with the amplify-js library.

Description of changes

This adds a Vite app to the bundle-size action directory

Issue #, if available

The errors are seen in #7499

Description of how you validated changes

To reproduce, run yarn dev.
Or
yarn build

@ErikCH ErikCH requested a review from sammartinez as a code owner March 19, 2021 18:03
We want to ensure we continue running against the newest versions, like customers do
Comment on lines +14 to +16
"@vitejs/plugin-vue": "^1.1.5",
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this use latest? I don't know how this project is initialized, so I'm uncertain if these are latest, next, or specifically defined from some external docs.

Copy link
Author

Choose a reason for hiding this comment

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

This is what's configured after a yarn create @vitejs/app

@lgtm-com
Copy link

lgtm-com bot commented Mar 19, 2021

This pull request introduces 3 alerts when merging de50adb into 492f925 - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

Comment on lines 12 to 14
if(global === undefined){
global = window;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

yarn dev initially failed for me, then I changed this to:

		<script>
			// https://docs.amplify.aws/start/getting-started/setup/q/integration/angular#angular-6-support
			window.global = window;
		</script>

Now yarn dev works! But yarn build still fails...

@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #7970 (468a14c) into main (02d72e6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7970   +/-   ##
=======================================
  Coverage   74.25%   74.25%           
=======================================
  Files         215      215           
  Lines       13473    13473           
  Branches     2646     2646           
=======================================
  Hits        10004    10004           
  Misses       3271     3271           
  Partials      198      198           
Impacted Files Coverage Δ
packages/core/src/Platform/version.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 492f925...468a14c. Read the comment docs.

@ericclemmons
Copy link
Contributor

So we learned the following:

  1. @aws-sdk/credential-provider-imds is only required by @aws-sdk/credential-provider-node

  2. @aws-sdk/credential-provider-node is defined in runtimeConfig.ts within the @aws-sdk/client-* packages.

  3. AWS SDK has a browser field for bundlers to use runtimeConfig.browser.ts instead, but Vite doesn't seem to be respecting this:

My question is, how can we or aws-sdk-js-v3 define exports or something so that Vite picks up on it since it won't respect browser?

@lgtm-com
Copy link

lgtm-com bot commented Mar 22, 2021

This pull request introduces 3 alerts when merging 468a14c into 5af2e1a - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

@ErikCH
Copy link
Author

ErikCH commented Mar 22, 2021

I have uploaded a newer work around, that should allow amplify to work with Vite. See -> https://github.com/aws-amplify/amplify-js/issues/7499#issuecomment-804386820

@sammartinez sammartinez changed the title Vite Bundle Size Action Example Demonstrating Vite Errors with library chore: Vite Bundle Size Action Example Demonstrating Vite Errors with library Oct 27, 2021
@lgtm-com
Copy link

lgtm-com bot commented Oct 27, 2021

This pull request introduces 2 alerts when merging 0ac0dc6 into 2b800f5 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class

@ErikCH
Copy link
Author

ErikCH commented Oct 27, 2021

No longer needed, I'll close this.

@ErikCH ErikCH closed this Oct 27, 2021
@ErikCH ErikCH deleted the hotfix/error-with-vite branch October 27, 2021 17:30
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants