Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 6337047

Browse files
committed
fix(build-in.ts): fix import type
1 parent 3609227 commit 6337047

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/_internal/utils/build-in.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
'use server';
22

3-
import { readFileSync, appendFileSync, existsSync } from 'fs';
3+
import * as fs from 'fs';
4+
import * as path from 'path';
45
import { isServer } from './helper';
5-
import { join } from 'path';
66

77
export const buildIn = async (styleSheet: string, global?: string): Promise<void> => {
8-
const styleFilePath = join(__dirname, '../../core/styles/style.module.css');
9-
const globalFilePath = join(__dirname, '../../core/styles/global.css');
8+
const styleFilePath = path.join(__dirname, '../../core/styles/style.module.css');
9+
const globalFilePath = path.join(__dirname, '../../core/styles/global.css');
1010

1111
const filePath = global === '--global' ? globalFilePath : styleFilePath;
1212
const message = global === '--global' ? ' ✅ Generating global static css \n' : ' ✅ Generating module static css \n';
1313

1414
if (!isServer) return;
1515
try {
16-
if (existsSync(filePath)) {
17-
const cssData = readFileSync(filePath, 'utf-8');
16+
if (fs.existsSync(filePath)) {
17+
const cssData = fs.readFileSync(filePath, 'utf-8');
1818
if (!cssData.includes(styleSheet)) {
19-
appendFileSync(filePath, styleSheet, 'utf-8');
19+
fs.appendFileSync(filePath, styleSheet, 'utf-8');
2020
console.log(message + styleSheet);
2121
}
2222
} else {
23-
appendFileSync(filePath, styleSheet, 'utf-8');
23+
fs.appendFileSync(filePath, styleSheet, 'utf-8');
2424
console.log(message + styleSheet);
2525
}
2626
} catch (error) {

0 commit comments

Comments
 (0)