Object doesn't support property or method 'replace' on Internet Explorer 11

折月煮酒 提交于 2021-02-10 16:41:28

问题


I am trying to make my Vuejs application work on IE11. However, one node module (vue-directive-tooltip) throw an error on IE11:

Object doesn't support property or methode "replace"

The module is supposed to be IE11 compatible. I have tried to require the polyfill I need at the top of the entry point to my application. I have also tried to add the node module to the transpile dependencies.

vue.config.js:

require("@babel/polyfill");

configureWebpack: {
  entry: ["@babel/polyfill", path.resolve(__dirname, "./src/main.js")],
}

babel.config.js:

module.exports = {
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [ ">0.25%"]
        },
        "useBuiltIns": "entry",
        "debug": true
      }
    ]
  ],
  "plugins": [
    "@babel/plugin-proposal-object-rest-spread"
  ]
};

I expect the vue-directive-tooltip to work on IE11, but the actual output is the following error message:

SCRIPT438: Object doesn't support property or method 'replace'.


回答1:


Adding the classList.js reference in the index.html was the solution.



来源:https://stackoverflow.com/questions/57292355/object-doesnt-support-property-or-method-replace-on-internet-explorer-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!