Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VueJs 3 + Vuetify: Not working in IE and Edge

I'm not sure what I'm doing wrong here. I have VueJs 3 with Vuetify. Works great with Chrome and Firefox, but it is not loading in IE and Edge. I am attempting to load polyfills with Babel and forcing Vue CLI to transpile dependencies for Vuetify.

package.json

"babel": {
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "entry"
      }
    ]
  ]
}

vue.config.js

module.exports: {
  transpileDependencies: ['vuetify']
}

main.ts

import 'core-js/es6';
import 'regenerator-runtime/runtime';

The imports are included at the top of my main.ts file. I have been using the official documentation to set this up.

What am I missing here?

like image 554
erichunt Avatar asked Sep 30 '19 14:09

erichunt


People also ask

Is Vue 3 compatible with Vuetify?

The current version of Vuetify does not support Vue 3.

Does Vue work in IE11?

The main reason why your Vue app is breaking in IE11 is because the browser does not support modern JavaScript syntax. By that I mean ES2015 and beyond. The Internet Explorer browser was deprecated in favour of Microsoft's more modern Edge browser.

Does Vue work in all browsers?

First of all, let me make it clear here that out-of-the-box Vue. js framework is pretty cross browser compatible. Nearly all basic components are supported by all major browsers that support JavaScript.

What browsers does Vue support?

VueJS offers cross-browser compatibility for websites and supports mostly all versions of Firefox, Chrome, Safari, etc.


1 Answers

If you created the project using vue-cli and added vuetify using vue add vuetify, then the solution to make it work in Edge should be to add transpileDependencies: ['vuetify'] to the vue.config.js file.

But in my case I added vue/vuetify to an already existing project and did not use vue-cli. So to make it work I installed core-js npm install core-js@2 --save and added this to the rules in my webpack.config.js

{
    test: /\.js$/,
    exclude: /node_modules\\(?!(vuetify)).*/,
    use: [
        {
            loader: 'babel-loader',
            options: {
                configFile: './babel.config.js',
            }
        }
    ]
}

Then I added the babel.config.js file to the root of the project.

module.exports = {
    presets: [
        ['@babel/preset-env', {
            debug: true,
            useBuiltIns: 'usage',
            corejs: { "version": 2, "proposals": true }
        }],
    ],
    plugins: [
        '@babel/plugin-proposal-object-rest-spread',
        '@babel/plugin-transform-spread',
    ]
}

A little late reply, but I couldn't find this solution anywhere else and this was one of the first posts showing up when I was searching for it myself. So I figured I'll post what worked for me here.

like image 54
Hammis82 Avatar answered Oct 16 '22 22:10

Hammis82