Answer the question
In order to leave comments, you need to log in
How to reduce compiled vue size with webpack?
I am using symfony with encore (webpack)
app.js file:
import Vue from 'vue';
new Vue({
el: '#applang',
})
import Vue from 'vue';
import search from './components/search/Search';
import store from './store';
...
new Vue({
el: '#appvue',
store,
components : {search},
...
}).$mount('#appvue');
import Vue from 'vue'
import Vuex from 'vuex'
import search from './modules/search';
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({
modules: {
search,
},
strict: debug,
})
Answer the question
In order to leave comments, you need to log in
Use vue.production.min.js instead of vue.min.js. This is an assembly without a template compiler.
It is impossible to get rid of Vue in Vuex, it is strongly tied to it.
Also set up and make sure that tree shaking works for you. Instructions are available on the webpack site. You can check it with the webpack bundle analyzer.
You have a problem with your webpack config or plugin conflicts, as it seems that the size increases due to the repeated inclusion of Vue modules. In theory, he should connect it once. Put the default config and rebuild everything, most likely it will help. In principle, commentator Stanislav Lashmanov , said everything that is needed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question