From cd52d340aa1c8dfa993c0057adb6b90b51e7c391 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Tue, 13 Jul 2021 21:34:54 -0700 Subject: [PATCH] fix(webpack): use path.resolve to create file path --- lib/webpack/plugin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/webpack/plugin.js b/lib/webpack/plugin.js index 6803909..34244c8 100644 --- a/lib/webpack/plugin.js +++ b/lib/webpack/plugin.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const path = require('path'); class KW_WebpackPlugin { constructor(options) { @@ -14,9 +15,10 @@ class KW_WebpackPlugin { // read generated file content and store for karma preprocessor this.controller.bundlesContent = {}; stats.toJson().assets.forEach((webpackFileObj) => { - const filePath = `${compiler.options.output.path}/${ + const filePath = path.resolve( + compiler.options.output.path, webpackFileObj.name - }`; + ); this.controller.bundlesContent[webpackFileObj.name] = fs.readFileSync( filePath, 'utf-8'