getting error when trying to upgrade to vuetify 2.0

自闭症网瘾萝莉.ら 提交于 2020-01-06 06:18:06

问题


Ok so I am trying for the second time to migrate thus far it has been a complete failure it seems that vuetify is not detected, unfortunately I cannot share my full repo since it is work related, but will describe steps and share relevant code. Project was created with vue-cli 3.3.0 with a vue.config.js file for environment variables. 1) npm uninstall vuetify 2)vue add vuetify 3)npm run serve my site does not load and I get this error (adding code):

//vue.config.js
module.exports = {
    chainWebpack: (config) => {
        config.plugin('define')
            .tap(([options, ...args]) => {

                let env = options['process.env'].VUE_APP_ENV.replace(/"/g,'');
                let envMdl = require('./build/' + env.toString() + '.js');

                // replace all current by VUE concrente ones to be passed to the app
                const processEnv = Object.assign({}, options['process.env'])
                Object.keys(envMdl).forEach(function (k) {
                    processEnv['VUE_APP_' + k] = envMdl[k];
                });

                const ret = Object.assign({}, options, {'process.env': processEnv});

                return [
                    ret,
                    ...args
                ]
            })
    }
}

//vuetify.js

import Vue from 'vue'
import Vuetify from 'vuetify/lib'

Vue.use(Vuetify)

export default new Vuetify({
  icons: {
    iconfont: 'mdiSvg',
  },
})

//main.js

import vuetify from './plugins/vuetify'
...
new Vue({
                vuetify,
                router,
                store,
                i18n,
                render: h => h(App),
...

Error message (and screenshot): Uncaught TypeError: _lib.default is not a constructor at eval (vuetify.js?402c:6)


回答1:


The main problem is that Vuetify v1 works under the Stylus preprocessor, and in v2 it works under the SASS preprocessor, and I personally do not recommend migrating to v2 if it is too advanced and even worse if it has custom Vuetify components.



来源:https://stackoverflow.com/questions/57555348/getting-error-when-trying-to-upgrade-to-vuetify-2-0

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