1 export default { 2 // Global page headers: https://go.nuxtjs.dev/config-head 3 head: { 4 title: 'website', 5 target: process.env.NODE_ENV !== 'production'?'static':'server', 6 htmlAttrs: { 7 lang: 'en' 8 }, 9 meta: [ 10 { charset: 'utf-8' }, 11 { name: 'viewport', content: 'width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0' }, 12 { hid: 'keywords', name: 'keywords', content: '' }, 13 { hid: 'description', name: 'description', content: '' } 14 ], 15 link: [ 16 { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } 17 ] 18 }, 19 router:{ 20 base: "/", //此为根目录,如果有具体目录需求按实际情况写 21 middleware: 'i18n' 22 }, 23 loading: { color: "#FE5800" }, 24 // Global CSS: https://go.nuxtjs.dev/config-css 25 css: [ 26 "~/assets/css/app" 27 ], 28 29 // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins 30 plugins: [ 31 { src: '~/plugins/i18n', ssr: true }, 32 { src: '~/plugins/axios', ssr: true }, 33 { src: '~/plugins/axios-api-plugin', ssr: true }, 34 { src: '~/plugins/vue-awesome-swiper', ssr: false }, 35 { src: '~/plugins/toast', ssr: false } 36 ], 37 // generate: { // 生成静态页 38 // routes: ['/','/zh',/] 39 // }, 40 // Auto import components: https://go.nuxtjs.dev/config-components 41 components: true, 42 43 // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules 44 buildModules: [ 45 ], 46 // Modules: https://go.nuxtjs.dev/config-modules 47 modules: [ 48 // https://go.nuxtjs.dev/bootstrap 49 'bootstrap-vue/nuxt', 50 '@nuxtjs/axios', 51 '@nuxtjs/proxy', 52 '@nuxtjs/component-cache', 53 [ 54 '@nuxtjs/component-cache', 55 { 56 max: 10000, // 最大缓存数量 57 maxAge: 1000 * 60 * 60 // 缓存过期时间(ms),缓存1小时 58 } 59 ] 60 ], 61 bootstrapVue: { 62 components: ['BContainer', 63 'BNavbar', 64 'BNav', 65 'BNavbarBrand', 66 'BNavbarToggle', 67 'BCollapse', 68 'BNavbarNav', 69 'BNavItem', 70 'BRow', 71 'BCol', 72 'BNavForm', 73 'BForm', 74 'BFormGroup', 75 'BFormTextarea', 76 'BFormSelect', 77 'BFormInput', 78 'BFormInvalidFeedback', 79 'BButton', 80 'BNavItemDropdown', 81 'BDropdownItem', 82 'BCard', 83 'BImg', 84 'BImgLazy', 85 'BOverlay', 86 'BLink', 87 'BPopover', 88 'BCarousel', 89 'BCarouselSlide', 90 'BEmbed', 91 'BPaginationNav', 92 'BIconSearch', 93 'BIconGlobe', 94 'BIconTelephoneFill', 95 'BIconEnvelope', 96 'BIconPencilSquare', 97 'BIconPlayCircle', 98 'BIconPauseCircle', 99 'BIconXCircle', 100 'BIconInfoCircle', 101 'BIconEyeFill', 102 'BIconX', 103 'BIconGeoAltFill' 104 ], 105 directives:['VBPopover','VBToggle'], 106 //引入icon 107 // icons: false, 108 // 自定义样式,以下两属性设置false 109 bootstrapCSS: false, 110 bootstrapVueCSS: false 111 }, 112 113 // Build Configuration: https://go.nuxtjs.dev/config-build 114 build: { 115 transpile: [/^bootstrap-vue/], 116 // analyze: true, // 开启打包分析 117 productionSourceMap: false, 118 productionGzip: true, 119 productionGzipExtensions: ['js', 'css', 'svg'], 120 postcss: { 121 preset: { 122 autoprefixer: { 123 grid: true 124 } 125 } 126 }, 127 /** 128 * 图片 进行 url 的打包 129 */ 130 loader:[ 131 { 132 test:/.(png|jpg|gif|svg)$/, 133 loader:"url-loader", 134 query:{ 135 limit:10000, 136 name:"img/[name].[hash].[ext]" 137 } 138 } 139 ], 140 extend(config, ctx) { 141 config.module.rules.push({ 142 test: /.(ogg|mp3|mp4|wav|mpe?g)$/i, 143 loader: 'file-loader', 144 options: { 145 name: '[path][name].[ext]' 146 } 147 }); 148 149 }, 150 // plugins: [ 151 // new CompressionWebpackPlugin({ 152 // algorithm: 'gzip', 153 // test: /.(js|css|html)$/, 154 // threshold: 10240, 155 // minRatio: 0.8 156 // }) 157 // ] 158 }, 159 // 发起跨域资源请求 160 // axios: { 161 // baseURL: 'http://debug.globalyadea.com', 162 // credentials: true, 163 // proxy: process.env.NODE_ENV !== 'production'?true:false 164 // }, 165 // proxy: { 166 // '/api': { 167 // target: 'http://debug.globalyadea.com', 168 // changeOrigin: true, 169 // pathRewrite: { 170 // '^/api' : '/' 171 // } 172 // } 173 // } 174 }