npm包入口文件代码如下
// index.js  
import store from './src/store/index'  
export let CoreStore = store
npm包内store/index代码如下
// src/store/index.js  
import Vue from 'vue'  
import Vuex from 'vuex'  
Vue.use(Vuex)  
const store = new Vuex.Store({  
    state: {user: {}},  
    actions: {  
        getUserInfo() {  
           /* #ifdef MP-ALIPAY */  
            console.log(11111111)  
            /* #endif */  
            /* #ifdef MP-WEIXIN */  
            console.log(22222222)  
            /* #endif */  
            /* #ifdef MP-TOUTIAO */  
            console.log(33333333)  
            /* #endif */  
            /* #ifdef MP-BAIDU */  
            console.log(44444444)  
            /* #endif */  
            /* #ifdef MP-QQ */  
            console.log(55555555)  
            /* #endif */  
            /* #ifdef H5 */  
            console.log(66666666)  
            /* #endif */  
        }  
    }  
})
                                    
                                 
丶听雨 (作者)
可以了,感谢
2020-08-27 11:10