From 9ef1de00b58d6a4a759def6ee0617116127a05d7 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/index.js | 1 - test/cases/publicpath-function/webpack.config.js | 6 +++++- 3 files changed, 5 insertions(+), 2 deletions(-) rename test/cases/publicpath-function/expected/{main.css => nested/style.css} (100%) delete mode 100644 test/cases/publicpath-function/index.js 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/index.js b/test/cases/publicpath-function/index.js deleted file mode 100644 index d4e71361..00000000 --- a/test/cases/publicpath-function/index.js +++ /dev/null @@ -1 +0,0 @@ -import './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) + '/', } },