The rough underlying implementation is more or less done. Right now we're deciding betwen two forms, require('a.png') vs. requireStatic('a.png').
- Pros: more familiar. One single requirefor assets too.
- Cons: Doesn't follow the CommonJS specs. Overloads require.
- Pros: isn't tied to CommonJS.
- Cons: another thing to learn.
My feeling about this is that is
require()is sweeeeet,requireStatic()is explicit and doesn't break anything.I want to say
require(), but I think the right choice is to userequireStatic()simply because this it "scales", it doesn't prevent anyone from implementingrequireBlaBla()and still keeping it in the style, would anyone actually find that useful? I don't know. I often end up implementing intuitive (but magic) behavior, but when I have to choose I'm always drawn to clean descriptive and unambigiuous APIs.For that reason I would personally vote for
requireStatic()(even though I love the idea ofrequire()).