substitute-loader
v1.0.0
Published
A loader for webpack which substitutes the content of a file
Maintainers
Readme
Substitute loader for webpack
Replaces the content of a file. Defaults to nullbut you can supply the new content as parameter.
Install
$ npm i -S substitute-loader
Usage
module: {
loaders: [ {
test: /\.mock.json$/,
// default
loader: "substitute"
// custom content
// loader: "substitute?{content: '{}'}"
} ]
}// default, mock will equal null
var emptyMock = require("substitute!./mock.json");
// custom, mock will equal "{}"
var emptyMock = require("substitute!./mock.json?" + JSON.stringify({}));