pcui icon indicating copy to clipboard operation
pcui copied to clipboard

@babel/helper-regex missing

Open kungfooman opened this issue 4 years ago • 1 comments

Just tried to build via webpack and the result is:

image

npm i @babel/helper-regex fixes this, not sure why it seems to work for others 🤔

kungfooman avatar Jan 16 '21 12:01 kungfooman

Hmm. I just built it and I don't see this error. Also there is no @babel/helper-regex module in my node_modules folder. From your log, it looks like @babel/helper-create-regexp-features-plugin module is requiring it. I have that module, but it doesn't require it. In my case it is version 7.12.13. Maybe you could check there.

image

LeXXik avatar Feb 06 '21 12:02 LeXXik

@kungfooman Did you ever figure out what was going on with this?

willeastcott avatar Nov 02 '22 17:11 willeastcott

@kungfooman Did you ever figure out what was going on with this?

I never figured it out, the source code is here: https://github.com/babel/babel/blob/master/packages/babel-helper-regex/src/index.js

import pull from "lodash/pull";

export function is(node: Object, flag: string): boolean {
  return node.type === "RegExpLiteral" && node.flags.indexOf(flag) >= 0;
}

export function pullFlag(node: Object, flag: string) {
  const flags = node.flags.split("");
  if (node.flags.indexOf(flag) < 0) return;
  pull(flags, flag);
  node.flags = flags.join("");
}

It checks on AST level if there is a RegEx with a certain modifier flag (like g or m), but it still puzzles me why only my installation would require that.

The "solution" was also simple enough, so I guess we can just close it.

kungfooman avatar Nov 03 '22 09:11 kungfooman