vue-cli
Pan 2018-10-25 13:25:04 +08:00
parent 073462853e
commit 3d34b959ff
2 changed files with 27 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">

View File

@ -1,10 +1,20 @@
var path = require('path') // Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
const path = require('path')
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, './', dir) return path.join(__dirname, './', dir)
} }
module.exports = { module.exports = {
/**
* You can set by yourself according to actual condition
* You will need to set this if you plan to deploy your site under a sub path,
* for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
* then assetsPublicPath should be set to "/bar/".
* In most cases please use '/' !!!
* Detail https://cli.vuejs.org/config/#baseurl
*/
baseUrl: '/', baseUrl: '/',
outputDir: 'dist', outputDir: 'dist',
assetsDir: 'static', assetsDir: 'static',
@ -19,6 +29,13 @@ module.exports = {
} }
// proxy: {} // proxy: {}
}, },
configureWebpack: {
resolve: {
alias: {
'@': resolve('src')
}
}
},
chainWebpack: config => { chainWebpack: config => {
config.plugins.delete('preload') config.plugins.delete('preload')
config.plugins.delete('prefetch') config.plugins.delete('prefetch')
@ -46,7 +63,14 @@ module.exports = {
config config
.when(process.env.NODE_ENV !== 'development', .when(process.env.NODE_ENV !== 'development',
config => { config => {
config.optimization.splitChunks({ config
.plugin('ScriptExtHtmlWebpackPlugin')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
config
.optimization.splitChunks({
chunks: 'all', chunks: 'all',
cacheGroups: { cacheGroups: {
libs: { libs: {