webpack打包后发布到npm,引入为空

项目 vue-2.5.0 webpack-3.6.0

项目输出文件:

    const install = function(Vue, opts = {}) {
    
      Object.keys(components).forEach(key => {
        Vue.component(key, components[key]);
      });
    
      Vue.prototype.$Modal = lanModal;
      Vue.prototype.$Message = lanMessage;
    };
    
    if (typeof window !== 'undefined' && window.Vue) {
      install(window.Vue);
    };
    
    export default {
      version: '0.0.8',
      install,
      ...components
    };

通过npm发包后引入:

    import ui from 'lanlan-ui'

可是引入的为空对象,不知道为什么?求助,webpack2以上输出就不用module.exports,用的export default但是没结果

阅读 4.8k
3 个回答

你得确定lanlan-ui是否用了export default的写法

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题