From 5f9076872a93276b401d12e57d2a6aeb02adb2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mrozek?= Date: Mon, 16 Oct 2023 09:51:14 +0200 Subject: [PATCH] fix: compilation output path --- src/webpack-mjml-store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webpack-mjml-store.js b/src/webpack-mjml-store.js index 279f194..f24b629 100644 --- a/src/webpack-mjml-store.js +++ b/src/webpack-mjml-store.js @@ -5,7 +5,7 @@ const packageJSON = require('../package'); const webpack = require('webpack'); const { RawSource } = webpack.sources; const { NoSourceFilesWarning, BeautifyOptionDeprecated, MinifyOptionDeprecated, ErrorsMJMLParsing } = require('./errors/'); -const { basename } = require('path'); +const { basename, relative } = require('path'); /** * @param {string} inputPath The path where `.mjml` files are located. @@ -49,7 +49,7 @@ WebpackMjmlStore.prototype.apply = function (compiler) { compilation.fileDependencies.add(file); const data = await that.convertFile(file, outputFile); - compilation.emitAsset(basename(outputFile), new RawSource(data.response), { + compilation.emitAsset(relative(compilation.outputOptions.path, outputFile), new RawSource(data.response), { immutable: data.response === data.readable, javascriptModule: false });