Skip to content

Commit

Permalink
fix: fix overwrite style file in preserveModules mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RunningCoderLee committed Jun 11, 2020
1 parent 8d2c18e commit 2c13345
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ test("nested", async () => {
const inSource = `${outDir}/this/is/nested/${map.sources[0]}`;
await expect(fs.pathExists(inSource)).resolves.toBeTruthy();
const source = await fs.readFile(inSource, "utf8");
expect(map.sourcesContent && map.sourcesContent[0]).toBe(source);
expect(map.sourcesContent?.[0]).toBe(source);
});

test("augment-chunk-hash", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default (options: Options = {}): Plugin => {

const getName = (chunk: OutputChunk): string => {
if (opts.file) return path.basename(opts.file, path.extname(opts.file));
if (preserveModules) return path.basename(chunk.fileName, path.extname(chunk.fileName));
if (preserveModules) return chunk.fileName.replace(/\.[^./\\]+$/, "");
return chunk.name;
};

Expand Down

0 comments on commit 2c13345

Please sign in to comment.