Load React + Emotion from CDN URLs, use globals
Remove @emotion/babel-preset-css-prop and import { jsx } from @emotion/core directly instead so Rollup can preserve imports order when bundling (instead of @emotion/core automatically inserting itself as the first import).
This commit is contained in:
16
modules/utils/getScripts.js
Normal file
16
modules/utils/getScripts.js
Normal file
@ -0,0 +1,16 @@
|
||||
import invariant from 'invariant';
|
||||
|
||||
import getEntryPoint from './getEntryPoint';
|
||||
|
||||
export default function getScripts(entryName, globalURLs) {
|
||||
const entryPoint = getEntryPoint(entryName, 'iife');
|
||||
|
||||
invariant(entryPoint, 'Invalid entry name "%s"', entryName);
|
||||
|
||||
const globalScripts = entryPoint.globalImports.map(id => {
|
||||
invariant(globalURLs[id], 'Missing global URL for id "%s"', id);
|
||||
return globalURLs[id];
|
||||
});
|
||||
|
||||
return globalScripts.concat(entryPoint.url);
|
||||
}
|
Reference in New Issue
Block a user