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]);
|
val[0] = path.resolve(optionsDir, val[0]);
|
||||||
} else {
|
} else {
|
||||||
|
let name = val[0];
|
||||||
|
const match = name.match(/^(@babel\/(?:plugin-|preset-)?)(.*)$/);
|
||||||
|
if (match) {
|
||||||
|
name = match[2];
|
||||||
|
}
|
||||||
|
|
||||||
const monorepoPath = path.join(
|
const monorepoPath = path.join(
|
||||||
path.dirname(fileURLToPath(import.meta.url)),
|
path.dirname(fileURLToPath(import.meta.url)),
|
||||||
"../..",
|
"../..",
|
||||||
`babel-${type}-${val[0]}`,
|
`babel-${type}-${name}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fs.existsSync(monorepoPath)) {
|
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;
|
val[0] = monorepoPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
[
|
[
|
||||||
"@babel/preset-env",
|
"env",
|
||||||
{
|
{
|
||||||
"shippedProposals": true,
|
"shippedProposals": true,
|
||||||
"targets": {
|
"targets": {
|
||||||
"chrome": "75"
|
"chrome": "75"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
]
|
]
|
||||||
}
|
]
|
||||||
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"externalHelpers": false,
|
"externalHelpers": false,
|
||||||
"presets": [
|
"presets": [
|
||||||
[
|
[
|
||||||
"@babel/preset-env",
|
"env",
|
||||||
{
|
{
|
||||||
"corejs": 3,
|
"corejs": 3,
|
||||||
"useBuiltIns": "entry"
|
"useBuiltIns": "entry"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
["@babel/preset-react", { "development": true }],
|
["react", { "development": true }],
|
||||||
"./emotion-css-prop-preset.js"
|
"./emotion-css-prop-preset.js"
|
||||||
],
|
],
|
||||||
"os": ["linux", "darwin"]
|
"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"]
|
"os": ["linux", "darwin"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user