Skip to content

Commit

Permalink
refactor: compatible with windows os
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Sep 7, 2023
1 parent 973e231 commit c22d1c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/builder/bundless/loaders/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { winPath } from '@umijs/utils';
import fs from 'fs';
import { runLoaders } from 'loader-runner';
import type { IApi } from '../../../types';
Expand Down Expand Up @@ -63,6 +64,7 @@ export default async (
const cacheRet = await cache.get(cacheKey, '');

// use cache first
/* istanbul ignore if -- @preserve */
if (cacheRet) {
const tsconfig = /\.tsx?$/.test(fileAbsPath)
? getTsconfig(opts.cwd)
Expand All @@ -75,7 +77,7 @@ export default async (
// FIXME: shit code for avoid invalid declaration value when tsconfig changed
declaration:
tsconfig?.options.declaration &&
tsconfig?.fileNames.includes(fileAbsPath),
tsconfig?.fileNames.includes(winPath(fileAbsPath)),
},
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/builder/bundless/loaders/javascript/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { winPath } from '@umijs/utils';
import { getTsconfig } from '../../dts';
import type { IBundlessLoader, IJSTransformer, ILoaderOutput } from '../types';

Expand Down Expand Up @@ -37,7 +38,7 @@ const jsLoader: IBundlessLoader = function (content) {
: undefined;
if (
tsconfig?.options.declaration &&
tsconfig?.fileNames.includes(this.resource)
tsconfig?.fileNames.includes(winPath(this.resource))
) {
outputOpts.declaration = true;
}
Expand Down

0 comments on commit c22d1c1

Please sign in to comment.