Skip to content

Commit

Permalink
Fix code samples for vite-polyfill for react/vue (#4989)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbuchel authored Feb 7, 2024
1 parent f15d22f commit ef95e35
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { InlineFilter } from '@/components/InlineFilter';

**1.** Add the following script tag to the `index.html` file right before the `</body>` tag. This will only run on the client side and will polyfill Node globals.

```html
Expand All @@ -13,6 +15,7 @@

**2.** Update the `vite.config.ts` (or `vite.config.js`) and add a resolve alias inside the `defineConfig({})` as seen below.

<InlineFilter filters={['react']}>
```ts
export default defineConfig({
plugins: [react()],
Expand All @@ -26,3 +29,20 @@ export default defineConfig({
}
})
```
</InlineFilter>

<InlineFilter filters={['vue']}>
```ts
export default defineConfig({
plugins: [vue()],
resolve: {
alias: [
{
find: './runtimeConfig',
replacement: './runtimeConfig.browser', // ensures browser compatible version of AWS JS SDK is used
},
]
}
})
```
</InlineFilter>

0 comments on commit ef95e35

Please sign in to comment.