fex-team / fis3-hook-node_modules

fis3 node_modules 支持
81 stars 12 forks source link

[不知道该不该提在这里]加载Vue时报错 #50

Closed fancyboynet closed 8 years ago

fancyboynet commented 8 years ago

期望调用方式

var Vue = require('vue');

结果报错

vue.common.js:2539 [Vue warn]: Failed to mount component: template or render function not defined. (found in root instance)

问题分析

Vue默认指向的是 dist/vue.common.js文件,而vue.common.js没有进行umd包装

{
    "main": "dist/vue.common.js",
}

目前解决方法,显示引入 dist/vue.js

var Vue = require('/node_modules/vue/dist/vue.js');

有其他推荐的解决方案吗?

xxapp commented 8 years ago

在 fis-conf.js

fis.hook('commonjs', {
    paths: {
        vue: '/node_modules/vue/dist/vue.js'
    }
});
fancyboynet commented 8 years ago

@xxapp 谢啦