Note: This is the 2.0+ version of VUE-CLI

1, packaging does not convert images to base64

Recently, I did a small project. When I was packing, I found that two pictures were generated for me and some of them were converted to Base64. Even if I changed the limit value, it would still change, which was very annoying.

For front-end processing, retain the original TTF, eOT and other font file names, only use file-loader for processing, do not use url-loader, and modify the webpack.base.conf.js file under the build folder

If the font is used, it is best to also modify the ask file-loader





2. After packing, the picture disappeared. It was the wrong address

Find build under utils.js and change it.. /.. / If CDN is required, change this path to CDN image path



3. CSS path problem change this parameter to./ or CDN line path



4. Local development agents for cross-domain issues

Add the red arrow Mosaic to change the address you need to request, (because this is the address developed by my company, SO I made the Mosaic)



5. Develop optimization questions, such as Vue axios and Elemui… These are CDN connected, there is no need to pack them


Webpack.base. Config. js externals in build

Process.env.node_env to determine whether the environment is development or production, there is no need to switch back and forth



NPM run dev is development time, and NPM run build is package time to go live








Dev.html (NPM run dev)

Index. HTML introduced into CDN dev.html is not required



Js on the left and dev.js on the right

Comment out what you don’t need