Fix entry-point with date time on filename

This commit is contained in:
g45t345rt 2021-03-24 12:44:26 -04:00
parent 6ab4b5fb2c
commit 3e3159278d

View File

@ -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);