Create-react-app: Provide require() in console

Created on 22 Jul 2016  路  5Comments  路  Source: facebook/create-react-app

We should figure out a way to provide a global require() in DEV mode in the browser console.
It could be implemented as a webpack plugin (everything is a plugin in webpack right?)

It could work like this:

  • For modules with unique names, require('moduleName') just works
  • For modules with non-unique names, require('./full/path/from/root') is the only way

Still not too bad!

Most helpful comment

You can try it out on facebook.com fyi, it's super useful for debugging

All 5 comments

What is the use case for this? So I can go to my dev tools console and access a module? That would be helpful, I'd like to dig into it.

Yea, it's for debugging individual modules when something specific doesn't quite work, and you want to call it directly.

screen shot 2016-07-24 at 9 04 53 am

This is freaking handy indeed!

You can try it out on facebook.com fyi, it's super useful for debugging

Closing for a lack of a specific proposal. It鈥檚 not clear how this would work with relative imports so unless somebody prototypes this, I likely won鈥檛 be working on it.

Was this page helpful?
0 / 5 - 0 ratings