Skip to content

Commit c4bcb55

Browse files
committed
feat: more es6 support
1 parent 85f0739 commit c4bcb55

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/loaders/postcss/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import postcssUrl from "./url";
1616
import postcssModules from "./modules";
1717
import postcssICSS from "./icss";
1818
import postcssNoop from "./noop";
19+
import { dirname } from "path";
20+
import { fileURLToPath } from "url";
21+
22+
const __dirname = dirname(fileURLToPath(import.meta.url));
1923

2024
let injectorId: string;
2125
const testing = process.env.NODE_ENV === "test";

src/utils/resolve.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import resolver, { sync, AsyncOpts, SyncOpts, PackageJSON } from "resolve";
1+
import resolver, { AsyncOpts, SyncOpts, PackageJSON } from "resolve";
22
import { resolve as resolveExports, legacy as resolveFields } from "resolve.exports";
33
import arrayFmt from "./array-fmt";
4+
import { dirname } from "path";
5+
import { fileURLToPath } from "url";
6+
7+
const __dirname = dirname(fileURLToPath(import.meta.url));
48

59
interface Package extends PackageJSON {}
610
type PackageFilterFn = (pkg: Package, pkgfile: string) => Package;
@@ -89,7 +93,7 @@ export async function resolveAsync(ids: string[], userOpts: ResolveOpts): Promis
8993

9094
const resolverSync = (id: string, options: SyncOpts = {}): string | undefined => {
9195
try {
92-
return sync(id, options);
96+
return resolver.sync(id, options);
9397
} catch {
9498
return;
9599
}

0 commit comments

Comments
 (0)