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

Commit b0c51d9

Browse files
committed
fix(build-in.ts): set fs and path to server side only
1 parent 97eae66 commit b0c51d9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/_internal/utils/build-in.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
'use server';
2-
3-
import * as fs from 'fs';
4-
import * as path from 'path';
52
import { isServer } from './helper';
63

74
export const buildIn = (styleSheet: string, global?: string): void => {
5+
if (!isServer) return;
6+
let fs: typeof import('fs');
7+
let path: typeof import('path');
8+
fs = require('fs');
9+
path = require('path');
10+
811
const styleFilePath = path.join(__dirname, '../../core/styles/style.module.css');
912
const globalFilePath = path.join(__dirname, '../../core/styles/global.css');
1013

1114
const filePath = global === '--global' ? globalFilePath : styleFilePath;
1215
const message = global === '--global' ? ' ✅ Generating global static css \n' : ' ✅ Generating module static css \n';
1316

14-
if (!isServer) return;
1517
try {
1618
if (fs.existsSync(filePath)) {
1719
const cssData = fs.readFileSync(filePath, 'utf-8');

0 commit comments

Comments
 (0)