1 |
|
2 |
|
3 | import type { ValidatedOptions } from "./validation/options";
|
4 | import getTargets, { type Targets } from "@babel/helper-compilation-targets";
|
5 |
|
6 | export function resolveTargets(
|
7 | options: ValidatedOptions,
|
8 | // eslint-disable-next-line no-unused-vars
|
9 | root: string,
|
10 | // eslint-disable-next-line no-unused-vars
|
11 | filename: string | void,
|
12 | ): Targets {
|
13 | let { targets } = options;
|
14 | if (typeof targets === "string" || Array.isArray(targets)) {
|
15 | targets = { browsers: targets };
|
16 | }
|
17 |
|
18 | if (targets && targets.esmodules) {
|
19 | targets = { ...targets, esmodules: "intersect" };
|
20 | }
|
21 |
|
22 | return getTargets((targets: any), {
|
23 | ignoreBrowserslistConfig: true,
|
24 | browserslistEnv: options.browserslistEnv,
|
25 | });
|
26 | }
|