Closed mattdesl closed 10 years ago
Most loader documentation show examples with loaders inlined in require calls, because it's very simple. But in real code you would never do so (there are exceptions, i. e. bundle-loader). You would apply the loaders in your webpack.config.js.
Feel free to update the README with more realistic example in a PR.
Gotcha. Submitted PR
I'm trying to grasp why this would be useful:
var x = require("!transform?brfs!./file.js");
It seems to be the exact same as:
var x = require('./file.js')
The point of using brfs is to inline a file (like text, json, image, etc) into the bundle as utf8 string or Buffer. Whereas, at least in my tests, the explicit
!transform?brfs!
seems to try and parse the file as JS source code, so it fails when you try to inline typical text/JSON/etc.Maybe the docs should be updated to show a more realistic case. e.g. Setting up your webpack config so that it can consume any modules that might use brfs and
fs.readFileSync
.