Skip to content

Commit

Permalink
Support json modules
Browse files Browse the repository at this point in the history
This is a proposal for a fix to webpack-contrib#74. It is not elegant but it gets the job done
  • Loading branch information
rmja authored Jul 4, 2018
1 parent 8597dd4 commit b9fd9d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Author Tobias Koppers @sokra
*/
var loaderUtils = require("loader-utils");
var LoaderDependency = require("webpack/lib/dependencies/LoaderDependency");

module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
Expand Down Expand Up @@ -43,6 +44,12 @@ module.exports.pitch = function(remainingRequest) {
" }\n",
"}" + chunkNameParam + ");"];
}
if (this._module.type !== "javascript/auto") {
var nmf = this._compilation.dependencyFactories.get(LoaderDependency);
this._module.type = "javascript/auto";
this._module.generator = nmf.getGenerator("javascript/auto");
this._module.parser = nmf.getParser("javascript/auto");
}
return result.join("");
}

Expand Down

0 comments on commit b9fd9d7

Please sign in to comment.