Like val-loader but runs file in a child compiler.
Works with babel and TypeScript.
npm install --save-dev value-loader
let a = require("value-loader!./file.js");
// => excute file.js while compiling and
// take the result as javascript code for including
This loader is also useful if you want to provide data for another loader:
require("css-loader!value-loader!./generateCss.js");
Or if you like to generate a json export similar to the tojson-loader, but with loaders executed:
require("raw-loader!value-loader!./resource.json.js");
Instead of getting the whole exports
object you can set name
to the
named export you want to retrieve.
require("css-loader!value-loader?name=default!./generateCss.js");
This work is heavily based on the work done by Nathan Tran for css-in-js-loader.
MIT