Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scripts/postcss-css-to-esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ function cssToEsmPostcssPlugin(opts) {
// it seems slower to read the old content, but writing the same content with no real changes
// (as in initial build and then watch mode) will cause an unnecessary dev server refresh
let oldContent = '';
if (fs.existsSync(filePath)) {
oldContent = fs.readFileSync(filePath).toString();
try {
oldContent = fs.readFileSync(filePath, 'utf8');
} catch (e) {
if (e.code !== 'ENOENT') {
throw e;
}
}

const content = getTSContent(targetFile, packageName, css, exportTokens);
Expand Down
Loading