Make sure to actually use yarn to install the main-packages, otherwise the packages.json#resolutions property will not be used and @babel/helpers would not get overruled
Overruled @babel/helpers to fix how initializers play with decorated properties. Thus circumventing the imperformant and lengthy code being generated by babel in the non-legacy option.
This commit is contained in:
30
packages/babel-helpers/test/fixtures/dependencies/multiple/plugin.js
vendored
Normal file
30
packages/babel-helpers/test/fixtures/dependencies/multiple/plugin.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
const defineHelper = require("../../../helpers/define-helper").default;
|
||||
|
||||
const dependency1 = defineHelper(__dirname, "dependency1", `
|
||||
export default function fn() { 0; }
|
||||
`);
|
||||
|
||||
const dependency2 = defineHelper(__dirname, "dependency2", `
|
||||
export default function fn() { 1; }
|
||||
`);
|
||||
|
||||
const main = defineHelper(__dirname, "main", `
|
||||
import dep1 from "${dependency1}";
|
||||
import dep2 from "${dependency2}";
|
||||
|
||||
export default function helper() {
|
||||
return dep1() + dep2();
|
||||
}
|
||||
`);
|
||||
|
||||
module.exports = function() {
|
||||
return {
|
||||
visitor: {
|
||||
Identifier(path) {
|
||||
if (path.node.name !== "REPLACE_ME") return;
|
||||
const helper = this.addHelper(main);
|
||||
path.replaceWith(helper);
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user