为何vuex未被打包进Vue.js的输出文件?
dependencies没有把vuex打包进入
"dependencies": { "@tinymce/tinymce-vue": "^3.0.1",
"axios": "^1.4.0",
"clipboard": "^2.0.11",
"dayjs": "^1.11.9",
"element-ui": "^2.15.13",
"fingerprintjs2": "^2.1.4",
"ipify": "^6.0.0",
"live-server": "^1.2.2",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"postcss": "^8.4.27",
"qs": "^6.11.2",
"tinymce": "^5.1.0",
"uuid": "^9.0.0",
"vue": "^2.5.2",
"vue-axios": "^3.5.2",
"vue-puzzle-vcode": "^1.1.10",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.1",
"vuex": "^3.6.2"
},
但是我在本机是可以允许,这代表我引入的imp vuex是可以的,但是打包之后就没有
index.js
import Vue from "vue"import Vuex from "vuex"
Vue.use(Vuex);
main.js
import Vue from 'vue'import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router'
import store from './store'
Vue.use(ElementUI);
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
// el: '#app',
// components: { App },
// template: '<App/>'
router,
store,
render: h => h(App)
}).$mount('#app')
回答:
打包没有是什么意思?和 dependencies 没关系。
想要产物中没有 vuex 需要修改 externals。
以上是 为何vuex未被打包进Vue.js的输出文件? 的全部内容, 来源链接: utcz.com/p/935245.html