Recently studying Vue Scaffolding , When packaging a project , The following problems arise , Summed up their own problems and Solutions .

* The project clearly runs without error, but there is no data after packaging
There are two possible reasons for this :
1.1) The first is the wrong path after packing ==> solve : You can click it first dist In the file index.html to glance at , You will find that there is one more path in front of each path .
, At this time, we need to package.json Create a directory named babel.config.js Documents of , Code in it : module.exports = {
presets: [ '@vue/cli-plugin-babel/preset' ] }
1.2) The second reason may be Vue-router Used in history pattern ,【Vue-router
Among them hash Mode and history pattern ,vue The default route for is hash pattern 】, The easiest way is to history Just comment out the mode , as follows :
const router = new VueRouter({ // mode: 'history', base: process.env.BASE_URL,
2. One of the problems we still have is , An error occurred while executing the pack and go command , We need to take a look at this time package.json Is the command in the file consistent with the command we executed , as follows
It's obvious at this point , Our execution package command should be :
npm run build:prod

So if we're in the middle of executing a command ‘xxx No time ’, Don't worry , We can go first package.json Check the file to see if there are any objects we need , Including the example we added by executing the command element-ui,vuex,vuex-router wait .

©2019-2020 Toolsou All rights reserved,
SpringMVC Frame in controller Layer gets the property value of the custom configuration file springboot Multi profile configuration Android 11 Official release !java Several common runtime exceptions and simple examples 【JAVA】【 Huawei campus recruitment written examination - Software 】2020-09-0911-5 Output string at specified position [work] python read txt Last line of file Thread.getContextClassLoader And Thread.getClassLoader() difference Cheats developers apologize be based on RK3399 PWM Drive development