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 sourceRelDir = path.relative(path.dirname(rootDir), sourceDir);
const isModule = sourceBaseName.match(/\.module$/); const isModule = sourceBaseName.match(/\.module$/);
const tmpDir = path.resolve(tmpDirPath, sourceRelDir); const tmpDir = path.resolve(tmpDirPath, sourceRelDir);
const tmpFilePath = path.resolve(
let tmpFilePath = path.resolve(
tmpDir, tmpDir,
`${sourceBaseName}-tmp-${Date.now()}-${sourceExt.replace(".", "")}${ `${Date.now()}-${sourceBaseName}.css`
isModule ? ".module" : ""
}.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); await ensureDir(tmpDir);
const fileContent = await readFile(sourceFullPath); const fileContent = await readFile(sourceFullPath);