Skip to content

Webpack loader that executes file in a child compiler and return exports

License

Notifications You must be signed in to change notification settings

wikiwi/value-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Webpack loader that executes file in a child compiler and return exports

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published