对象不支持Internet Explorer 11上的属性或方法“替换" [英] Object doesn't support property or method 'replace' on Internet Explorer 11

查看:122
本文介绍了对象不支持Internet Explorer 11上的属性或方法“替换"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Vuejs应用程序在IE11上运行.但是,一个节点模块( vue-directive-tooltip )在IE11上引发错误:

对象不支持属性或方法替换"

该模块应该与IE11兼容.我试图在我的应用程序入口点的顶部要求我需要的polyfill.我还尝试过将节点模块添加到可转换依赖项中.

vue.config.js:

  require("@ babel/polyfill");configureWebpack:{条目:["@ babel/polyfill",path.resolve(__ dirname,"./src/main.js")],} 

babel.config.js:

  module.exports = {预设":[["@ babel/preset-env",{目标":{浏览器":[> 0.25%"]},"useBuiltIns":"entry",调试":true}]],插件":["@ babel/plugin-proposal-object-rest-spread"]}; 

我希望vue-directive-tooltip可以在IE11上运行,但实际输出是以下错误消息:

SCRIPT438:对象不支持属性或方法替换".

解决方案

解决方案

在index.html中添加classList.js参考是解决方案.

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'.

解决方案

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

这篇关于对象不支持Internet Explorer 11上的属性或方法“替换"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆