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:
2019-11-05 21:11:01 +01:00
parent 5ca9bec93a
commit 72f38c1137
47 changed files with 5004 additions and 80 deletions

View File

@@ -0,0 +1,25 @@
const defineHelper = require("../../../helpers/define-helper").default;
const dependency = defineHelper(__dirname, "dependency", `
export default function fn() {}
`);
const main = defineHelper(__dirname, "main", `
import dep from "${dependency}";
export default function helper() {
return dep();
}
`);
module.exports = function() {
return {
visitor: {
Identifier(path) {
if (path.node.name !== "REPLACE_ME") return;
const helper = this.addHelper(main);
path.replaceWith(helper);
},
},
};
};