Is there a polyfills.ts for `solid-start`? Or is there a way of modyfing the produced `index.html` ?
So, in the
aws amplify
framework there is a common bug, which all frameworks have to fix somehow:
https://github.com/aws-amplify/amplify-js/issues/678
global is not defined
One common solution is to add:
to the index.html
, which is how I fixed this in good old solid-js
. With solid-start
we don't have an index.html
any more and this variable needs to exist before the page is rendered (putting it into root.tsx
is not enough.)
Another common solution angular/svelte devs seem to use is to add the fix to a /src/polyfills.ts
. Do we have something comparable in solid-start
?1 Reply
One other idea suggested was to add it to the vite.config.ts, but it didn't seem to make a difference for me
PS: the error occurs only with
npm run dev
when the site is loaded on the client.
The npm run dev
command succeeds fine and the error only shows in the browser console
more on this: https://github.com/aws-amplify/amplify-js/issues/9639
(e.g. for Vue
and react
people have been able to fix it with
but that doesn't affect npm run dev
for me at all in solid-start environment)
The official Amplify documentation also mentions this for Vue
( https://ui.docs.amplify.aws/vue/getting-started/troubleshooting )
Where they say you have to put
into the index.html
mhmm, the only thing that allowed me to continue working was to use patch-package
and apply:
@thetarnav thats the only solution I found to edit the index.html
so it turns out
worked. I just had a typo above.
PS: Unfortunately, the global: {},
only works in dev
, although it allows yarn build
to succeed it'll trigger this.listeners.global is not a function
at runtime