From b9fd9d7319453722b92684e964188d02ac01bb3d Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Wed, 4 Jul 2018 11:55:21 +0200 Subject: [PATCH] Support json modules This is a proposal for a fix to #74. It is not elegant but it gets the job done --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index 54d3733..098cb92 100644 --- a/index.js +++ b/index.js @@ -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) { @@ -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(""); }