Skip to content

Commit

Permalink
Revert "fix(bundler-webpack): 修复 extraBabelIncludes 不能支持 htmlparser2 …
Browse files Browse the repository at this point in the history
…特例的问题 (#8480)"

This reverts commit 2954d97.
  • Loading branch information
sorrycc committed Jul 14, 2022
1 parent 426374e commit 89a8fdf
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@ export default {
nodeModulesTransform: {
type: 'none',
},
extraBabelIncludes: [
join(__dirname, '../.extraBabelIncludes'),
'foo',
'bar',
'pkg-up-name',
],
extraBabelIncludes: [join(__dirname, '../.extraBabelIncludes'), 'foo', 'bar'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IExpectOpts } from '../types';
export default ({ indexJS }: IExpectOpts) => {
expect(indexJS).toContain('var bar = 1;');
expect(indexJS).toContain('var foo = 1;');
expect(indexJS).toContain('var pkg = 1;');
expect(indexJS).toContain('var hoo = 1;');
expect(indexJS).toContain('let too = 1;');
expect(indexJS).not.toContain('var too = 1;');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
import bar from 'bar/bar';
// @ts-ignore
import foo from 'foo/foo';
// @ts-ignore
import pun from 'pkg-up-name';
import hoo from '../.extraBabelIncludes/hoo';
import too from '../.noExtraBabelIncludes/too';

bar();
foo();
pun();
hoo();
too();

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { semver } from '@umijs/utils';
import { pkgUp, semver } from '@umijs/utils';
import { dirname } from 'path';
import { pkgUpContainName } from './pkgUpContainName';

const pkgPathCache = {};
const pkgCache = {};
Expand Down Expand Up @@ -47,7 +46,7 @@ export function isMatch(opts: { path: string; pkgs: IPkgs }) {
function getPkgPath(opts: { path: string }) {
const dir = dirname(opts.path);
if (dir in pkgPathCache) return pkgPathCache[dir];
pkgPathCache[dir] = pkgUpContainName(dir);
pkgPathCache[dir] = pkgUp.sync({ cwd: opts.path });
return pkgPathCache[dir];
}

Expand Down
4 changes: 2 additions & 2 deletions packages/bundler-webpack/src/getConfig/pkgMatch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { pkgUp } from '@umijs/utils';
import { dirname } from 'path';
import { pkgUpContainName } from './pkgUpContainName';

const pkgPathCache = {};

export function getPkgPath(filePath: string) {
const dir = dirname(filePath);
if (dir in pkgPathCache) return pkgPathCache[dir];
pkgPathCache[dir] = pkgUpContainName(dir);
pkgPathCache[dir] = pkgUp.sync({ cwd: filePath });
return pkgPathCache[dir];
}

Expand Down
11 changes: 0 additions & 11 deletions packages/bundler-webpack/src/getConfig/pkgUpContainName.ts

This file was deleted.

0 comments on commit 89a8fdf

Please sign in to comment.