W3cubDocs

/webpack

exports-loader

Exports variables from inside the file by appending exports[...] = ... statements..

Install

npm i exports-loader --save

Usage

require("exports-loader?file,parse=helpers.parse!./file.js");
// adds below code to the file's source:
//  exports["file"] = file;
//  exports["parse"] = helpers.parse;

require("exports-loader?file!./file.js");
// adds below code to the file's source:
//  module.exports = file;

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/exports-loader