Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In corejs 3.15.0 version, regexp polifill does not work properly. #948

Closed
rever-whale opened this issue Jun 22, 2021 · 4 comments
Closed
Labels

Comments

@rever-whale
Copy link

rever-whale commented Jun 22, 2021

Hi. In corejs 3.15.0 version, regexp polifill does not work properly.
I am using corejs polyfill in ie11.

A sample script is as follows.

regExp = new RegExp(/^https?:\/\//i)
url = 'http://github.com'

result = url.match(regExp)
console.log(result) // null

In version 3.14, the following matching values ​​were found for the same script.

console.log(result) // [object Array] ["http://"]

My project's babel.config.js looks like this:

module.exports = {
  presets: [
    ['@vue/cli-plugin-babel/preset', {
      targets: {ie: '11'},
      modules: 'cjs',
    }],
  ],
  plugins: [
    ['@babel/plugin-transform-runtime', {
      corejs: 3,
    }],
  ],
  env: {
    production: {
      plugins: [['transform-remove-console', {exclude: ['error']}]],
    },
  },
};

Version 3.15.0

@zloirock
Copy link
Owner

zloirock commented Jun 22, 2021

@babel/plugin-transform-runtime does not inject RegExp polyfills, they are available only in the global version. OK, I see that @vue/cli-plugin-babel/preset exports @vue/babel-preset-app that somehow injects global version of core-js.

@zloirock
Copy link
Owner

Could you add a reproducible example?

@rever-whale
Copy link
Author

Sorry. There was a typo in example.
This is correct example.

const regExp = new RegExp(/^https?:\/\//i)
const url = 'http://github.com'

const result = url.match(regExp)
console.log(result)

Thx.

@zloirock
Copy link
Owner

Ok, I was able to reproduce it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants