Skip to content

Commit

Permalink
fix: 编译 css 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
joyzhan committed Jan 18, 2022
1 parent 76a76f5 commit 869187b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scripts/compilerCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ async function compilerCss(entryPath, outputPath) {
async function compilerStyleDir(codePath, outputDir) {
fse.copySync(codePath, outputDir);

const jsIndexPath = path.join(codePath, 'index.js');
const jsIndexPath = path.join(codePath, 'index.ts');
if (fse.existsSync(jsIndexPath)) {
fse.moveSync(
path.join(outputDir, 'index.ts'),
path.join(outputDir, 'index.js'),
);
const cssEntryPath = path.join(outputDir, 'css.js');
fse.outputFileSync(
cssEntryPath,
Expand Down
5 changes: 4 additions & 1 deletion scripts/injectcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function injectCss() {
const bundleItem = bundle[name];
if (name === 'index.js') {
const dir = path.dirname(bundleItem.facadeModuleId);
if (fs.existsSync(path.join(dir, 'style'))) {
if (
fs.existsSync(path.join(dir, 'style')) &&
!fs.existsSync(path.join(dir, 'style/themes'))
) {
bundleItem.code = `import './style';\n${bundleItem.code}`;
}
}
Expand Down

0 comments on commit 869187b

Please sign in to comment.