Force loading plugins/presets from the monorepo in tests (#13858)
This commit is contained in:
parent
513b00e60d
commit
780aa48d2a
@ -284,13 +284,25 @@ function wrapPackagesArray(type, names, optionsDir) {
|
||||
|
||||
val[0] = path.resolve(optionsDir, val[0]);
|
||||
} else {
|
||||
let name = val[0];
|
||||
const match = name.match(/^(@babel\/(?:plugin-|preset-)?)(.*)$/);
|
||||
if (match) {
|
||||
name = match[2];
|
||||
}
|
||||
|
||||
const monorepoPath = path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"../..",
|
||||
`babel-${type}-${val[0]}`,
|
||||
`babel-${type}-${name}`,
|
||||
);
|
||||
|
||||
if (fs.existsSync(monorepoPath)) {
|
||||
if (match) {
|
||||
throw new Error(
|
||||
`Remove the "${match[1]}" prefix from "${val[0]}", to load it from the monorepo`,
|
||||
);
|
||||
}
|
||||
|
||||
val[0] = monorepoPath;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
"env",
|
||||
{
|
||||
"shippedProposals": true,
|
||||
"targets": {
|
||||
@ -10,4 +10,4 @@
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"externalHelpers": false,
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
"env",
|
||||
{
|
||||
"corejs": 3,
|
||||
"useBuiltIns": "entry"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"presets": [
|
||||
["@babel/preset-react", { "development": true }],
|
||||
["react", { "development": true }],
|
||||
"./emotion-css-prop-preset.js"
|
||||
],
|
||||
"os": ["linux", "darwin"]
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
{
|
||||
"presets": [["@babel/preset-react", { "development": true, "runtime": "classic" }], "./my-preset"],
|
||||
"presets": [
|
||||
["react", { "development": true, "runtime": "classic" }],
|
||||
"./my-preset"
|
||||
],
|
||||
"os": ["linux", "darwin"]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user