-
Notifications
You must be signed in to change notification settings - Fork 301
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: add astro to troubleshooting guide #3410
Conversation
|
window.global = window; | ||
window.process = { | ||
env: { DEBUG: undefined }, | ||
} as unknown as NodeJS.Process; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: all astro files are TS files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one teeny comment
When working with a [Vite](https://vitejs.dev) project you must make a few modifications. Please follow the steps below. | ||
|
||
**1.** Add the following script tag to the `index.html` file at the bottom of the `<body>` tag. | ||
**1.** Add the following script tag to the `index.html` file right before the `</body>` tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much more explicit!
@@ -56,10 +96,9 @@ When working with a [Vite](https://vitejs.dev) project you must make a few modif | |||
</body> | |||
``` | |||
|
|||
**2.** Update the `vite.config.ts` and add in a resolve object inside the `defineConfig({})` as seen below. | |||
**2.** Update the `vite.config.js` and add in a resolve alias inside the `defineConfig({})` as seen below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove "in", "add in a resolve" v. "add a resolve"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this thread, and you can add in the window object in Vite as well, instead of adding it into the html file.
aws-amplify/amplify-js#9639 (comment)
export default defineConfig({
integrations: [react(), tailwind()],
vite: {
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
},
},
build: {
rollupOptions: {
plugins: [rollupNodePolyFill()],
},
},
resolve: {
alias: {
'./runtimeConfig': './runtimeConfig.browser',
},
},
},
})
That's what I've done with Nuxt, which is also another section we should add eventually.
export default defineConfig({
plugins: [react()],
define: {
global: {},
},
resolve: {
alias: {
"./runtimeConfig": "./runtimeConfig.browser",
},
},
});
I say that too. My concern there is that then you have to pull in an extra dependency |
docs/src/pages/[platform]/getting-started/troubleshooting/troubleshooting.react.mdx
Outdated
Show resolved
Hide resolved
…bleshooting.react.mdx
docs/src/pages/[platform]/getting-started/troubleshooting/troubleshooting.react.mdx
Outdated
Show resolved
Hide resolved
…bleshooting.react.mdx
docs/src/pages/[platform]/getting-started/troubleshooting/troubleshooting.react.mdx
Outdated
Show resolved
Hide resolved
…bleshooting.react.mdx
docs/src/pages/[platform]/getting-started/troubleshooting/troubleshooting.react.mdx
Outdated
Show resolved
Hide resolved
…bleshooting.react.mdx
I wasn't aware you had to pull in the pollyfill for it to work. In Nuxt case you don't have too. Then I'm fine with just adding it into the index.astro html file, and not adding the polyfill. |
Yeah, unfortunately there are Auth flows where |
Description of changes
Added instructions for Astro and updated instructions for Vite to be clearer. Also added both JS and TS version of the instructions and tested them out in an Astro app.
Issue #, if available
Related to: #3206 (comment)
Description of how you validated changes
Ran
yarn docs dev
and smoke tested the troubleshooting page:Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.