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 there! We'd like to migrate our existing Rollup-based builds to swc. One part of our application assigns js modules as variables to the window-object:
import*asReactfrom"react";window["React"]=React;
We had to tell rollup how to find these and that react shouldn't be bundled:
exportdefault({output: {intro: "const global = window",// Where are the global vars?external: ["react"],// What shouldn't be bundled?globals: {react: "React",// How can the react-imports be resolved?},},});
Is it possible to tell swc that some dependencies should be found in global variables? Is there an alternative approach that I didn't consider?
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there! We'd like to migrate our existing Rollup-based builds to swc. One part of our application assigns js modules as variables to the
window
-object:We had to tell rollup how to find these and that
react
shouldn't be bundled:Is it possible to tell swc that some dependencies should be found in global variables? Is there an alternative approach that I didn't consider?
Beta Was this translation helpful? Give feedback.
All reactions