UNPKG

to-string-loader

Version:
30 lines (24 loc) 686 B
var loaderUtils = require("loader-utils"); /** * @see https://webpack.github.io/docs/loaders.html */ module.exports = function() {} /** * @see https://webpack.github.io/docs/loaders.html#pitching-loader */ module.exports.pitch = function(remainingRequest) { if (this.cacheable) { this.cacheable(); } return ` var result = require(${loaderUtils.stringifyRequest(this, "!!" + remainingRequest)}); if (result && result.__esModule) { result = result.default; } if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } `; };