Home > Article > Web Front-end > vue-cli 2.x project optimization introduces local static library files
This article mainly introduces the introduction of local static library files about vue-cli 2.x project optimization. It has certain reference value. Now I share it with you. Friends in need can refer to it
1. Copy the corresponding xxx.min.js under node_modules to the project static folder
2.index.html Modify
Add script introduction
<script src="static/js/vue.min.js"></script> <script src="static/js/vue-router.min.js"></script>
3. Modify the build/webpack.base.conf.js file:
Comment out the following line
resolve: { extensions: ['.js', '.vue', '.json'], alias: { // 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), } },
Add the externals part (externals and resource are the same class).
externals: { 'vue': 'Vue', 'vue-router': 'VueRouter' },
demo address: https://github.com/cag2050/vu...
The above is the entire content of this article, I hope It will be helpful for everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
How vue solves the problem of refresh failure after addRoutes dynamically adds routes
Self-made vue component communication plug-in Use mixin to write plug-ins
The road to Vue activity creation project design and navigation bar development
The above is the detailed content of vue-cli 2.x project optimization introduces local static library files. For more information, please follow other related articles on the PHP Chinese website!