From 3e3159278db66e0b3d7930a1de5cf1da525d2b84 Mon Sep 17 00:00:00 2001 From: g45t345rt Date: Wed, 24 Mar 2021 12:44:26 -0400 Subject: [PATCH] Fix entry-point with date time on filename --- src/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 222431d..721df76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,13 +73,16 @@ const postCSSPlugin = ({ const sourceRelDir = path.relative(path.dirname(rootDir), sourceDir); const isModule = sourceBaseName.match(/\.module$/); const tmpDir = path.resolve(tmpDirPath, sourceRelDir); - const tmpFilePath = path.resolve( + + let tmpFilePath = path.resolve( tmpDir, - `${sourceBaseName}-tmp-${Date.now()}-${sourceExt.replace(".", "")}${ - isModule ? ".module" : "" - }.css` + `${Date.now()}-${sourceBaseName}.css` ); + // When CSS is an entry-point we don't want to append Date.now() + if (args.kind === "entry-point") + tmpFilePath = path.resolve(tmpDir, `${sourceBaseName}.css`); + await ensureDir(tmpDir); const fileContent = await readFile(sourceFullPath);