在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ 關(guān)于iView的Notification編譯出錯(cuò)的問(wèn)題。

關(guān)于iView的Notification編譯出錯(cuò)的問(wèn)題。

使用了iview-admin模版搭建后臺(tái)系統(tǒng)。

dev模式下一切正常。

當(dāng)執(zhí)行npm run build的時(shí)候出現(xiàn)了下面的錯(cuò)誤

ERROR in main.e53c38756696d4c01357.js from UglifyJs
Unexpected token: operator (>) [main.e53c38756696d4c01357.js:3795,84]

然后去具體位置查看,代碼如下:

__WEBPACK_IMPORTED_MODULE_0__notification_vue___default.a.newInstance = properties => {
    const _props = properties || {};

    const Instance = new __WEBPACK_IMPORTED_MODULE_1_vue__["default"]({
        data: _props,
        render (h) {
            return h(__WEBPACK_IMPORTED_MODULE_0__notification_vue___default.a, {
                props: _props
            });
        }
    });

    const component = Instance.$mount();
    document.body.appendChild(component.$el);
    const notification = Instance.$children[0];

    return {
        notice (noticeProps) {
            notification.add(noticeProps);
        },
        remove (name) {
            notification.close(name);
        },
        component: notification,
        destroy (element) {
            notification.closeAll();
            setTimeout(function() {
                document.body.removeChild(document.getElementsByClassName(element)[0]);
            }, 500);
        }
    };
};

第一行就是報(bào)錯(cuò)的地方,應(yīng)該是=>報(bào)錯(cuò)了,這是ES6語(yǔ)法,然后去查看了iview源碼對(duì)應(yīng)的地方:

import Notification from './notification.vue';
import Vue from 'vue';

Notification.newInstance = properties => {
    const _props = properties || {};

    const Instance = new Vue({
        data: _props,
        render (h) {
            return h(Notification, {
                props: _props
            });
        }
    });

    const component = Instance.$mount();
    document.body.appendChild(component.$el);
    const notification = Instance.$children[0];

    return {
        notice (noticeProps) {
            notification.add(noticeProps);
        },
        remove (name) {
            notification.close(name);
        },
        component: notification,
        destroy (element) {
            notification.closeAll();
            setTimeout(function() {
                document.body.removeChild(document.getElementsByClassName(element)[0]);
            }, 500);
        }
    };
};

export default Notification;

我查看了其他文件,包括這個(gè)報(bào)錯(cuò)的文件的其他部分,都是已經(jīng)從ES6轉(zhuǎn)換成了ES5的,就這一個(gè)地方?jīng)]有轉(zhuǎn)換,很奇怪,不知道是什么原因。

附上.babelrc配置:

{
    "presets": ["es2015", "stage-3"],
    "plugins": ["transform-runtime", "transform-vue-jsx"],
    "comments": true
}

webpack.base.config.js配置:

{
    test: /iview\/.*?js$/,
    loader: 'babel-loader'
},
{
    test: /\.js$/,
    loader: 'babel-loader',
    exclude: /node_modules/
},
{
    test: /\.js[x]?$/,
    include: [resolve('src')],
    exclude: /node_modules/,
    loader: 'happypack/loader?id=happybabel'
}

都是使用的iview-adminwebpack配置, 有遇到過(guò)這種情況的嗎?

求大神告知,感謝不盡,已經(jīng)困擾好幾天了。

回答
編輯回答
使勁操

下載最新版本的 iview-admin 試了一下,沒(méi)有遇到這個(gè)問(wèn)題,升級(jí)一下試試

2018年4月28日 11:50
編輯回答
雨蝶

很明顯是壓縮代碼的時(shí)候找不到 hash key

2017年1月13日 01:16