You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, I have noticed that Sandpack provides an externalResources option to load external scripts. How can I configure a global variable like webpack externals so that Sandpack does not load this package from the npm registry?
Consider a basic use case:
In a vanilla template, I would like to inject the global React variable via a CDN like jsdelivr:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi guys, I have noticed that Sandpack provides an
externalResources
option to load external scripts. How can I configure a global variable like webpack externals so that Sandpack does not load this package from the npm registry?Consider a basic use case:
In a
vanilla
template, I would like to inject the globalReact
variable via a CDN like jsdelivr:When writing
import React, { useEffect } from 'react'
in files, Sandpack should prevent loading the React package twice.One possible solution is to enhance the
externalResources
option as follows:Beta Was this translation helpful? Give feedback.
All reactions