From 821fce2100ab2674e74ef94446d6074219d1263e Mon Sep 17 00:00:00 2001 From: Bartosz Kopciuch Date: Wed, 18 Aug 2021 10:43:42 +0200 Subject: [PATCH 1/2] fix: support nested filenames in bundle for different OS --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 040a587..7c38ee1 100644 --- a/src/index.js +++ b/src/index.js @@ -171,9 +171,10 @@ export default (options = {}) => { const concat = new Concat(true, fileName, '\n') const entries = [...extracted.values()] + const relativePath = path.relative(dir, file) const { modules, facadeModuleId } = bundle[ - normalizePath(path.relative(dir, file)) - ] + normalizePath(relativePath) + ] || bundle[relativePath] if (modules) { const moduleIds = getRecursiveImportOrder( From 633dae1ad62a224aa46dc4aea3828f9d3e662736 Mon Sep 17 00:00:00 2001 From: Bartosz Kopciuch Date: Fri, 20 Aug 2021 11:42:41 +0200 Subject: [PATCH 2/2] add unit test --- test/index.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/index.test.js b/test/index.test.js index 0ee03c9..05e65db 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -454,3 +454,18 @@ test('augmentChunkHash', async () => { const barHash = barOne.fileName.split('.')[1] expect(barHash).not.toEqual(fooHash) // Verify that foo and bar does not hash to the same }) + +test('backslashEntryFilename', async () => { + const outDir = fixture('dist', 'backslashEntryFilename') + const file = 'simple/foo.css' + const newBundle = await rollup({ + input: fixture(file), + plugins: [postcss({ extract: true })] + }) + const { output } = await newBundle.write({ + dir: outDir, + entryFileNames: 'test\\foo.[hash].css' + }) + const hash = output[0].fileName.split('.')[1] + expect(hash).toBeTruthy() // Verify that [hash] part of `foo.[hash].css` is truthy +})