value-loader
v0.1.4
Published
Webpack loader that executes file in a child compiler and return exports
Downloads
247,789
Readme
Value Loader for Webpack
Like val-loader but runs file in a child compiler.
Works with babel and TypeScript.
Install
npm install --save-dev value-loader
Usage
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");
Config
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");
Acknowledgement
This work is heavily based on the work done by Nathan Tran for css-in-js-loader.
License
MIT