d3-require
                                
                                 d3-require copied to clipboard
                                
                                    d3-require copied to clipboard
                            
                            
                            
                        Specify the crossOrigin attribute when loading the module
This allows scripts like React to properly listen to the error event, allowing better debugging.
This will break require against a domain that doesn’t have CORS enabled, however. This should probably be an option. Hmm.
That’s unfortunate :(
Here are a couple ways of making it an option:
require('d3', { cors: true })
require.cors('d3')
Note that while the first one doesn’t currently work, it has syntactic parallels with how require.alias supports custom module values (maybe require could support them in the future?), so I prefer the second one. The second one also would make the code much simpler.
I’ve added a test, but it seems yarn test doesn’t actually run the tests.