From 0fa6e4b7e673739096f8d82352fcb4a5c170a225 Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Sat, 6 Apr 2019 07:14:08 +1300 Subject: [PATCH] fix: publicpath-function test demonstrates purpose With output of the CSS into a nested folder the computation of the relative publicPath makes sense. --- .../expected/{main.css => nested/style.css} | 0 test/cases/publicpath-function/webpack.config.js | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) rename test/cases/publicpath-function/expected/{main.css => nested/style.css} (100%) diff --git a/test/cases/publicpath-function/expected/main.css b/test/cases/publicpath-function/expected/nested/style.css similarity index 100% rename from test/cases/publicpath-function/expected/main.css rename to test/cases/publicpath-function/expected/nested/style.css diff --git a/test/cases/publicpath-function/webpack.config.js b/test/cases/publicpath-function/webpack.config.js index 30b243df..948b9db6 100644 --- a/test/cases/publicpath-function/webpack.config.js +++ b/test/cases/publicpath-function/webpack.config.js @@ -2,7 +2,10 @@ const Self = require('../../../'); const path = require('path') module.exports = { - entry: './index.js', + entry: { + // Specific CSS entry point, with output to a nested folder + 'nested/style': './nested/style.css', + }, module: { rules: [ { @@ -11,6 +14,7 @@ module.exports = { { loader: Self.loader, options: { + // Compute publicPath relative to the CSS output publicPath: (resourcePath, context) => path.relative(path.dirname(resourcePath), context) + '/', } },