Making Some Packages or Components Global

I’m looking for a way to make a few things global. I’d love to not have to import React into every file that I use as well as some components. For instance I use a styled component so much that it would be amazing to have it just be available without importing everywhere.

While I want to use explicit imports nearly everywhere, I’m wondering if there is some good way in Meteor’s system to have some items like the previously mentioned global.

How about just…

// in your entry point file, eg. main.js
import React from 'react';

window.React = React;


That would work, but I’m rendering React components server side.

If you’re trying to do this specifically for the React import, you can use to do it for you.

import React from 'react';

global.React = React;