Nuxt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

128 lines
3.2 KiB

const path = require('path');
console.log(__dirname + '/assets/style/_global.scss');
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
// process.env.npm_package_name ||
title: 'Beer',
meta: [{
charset: 'utf-8'
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no'
},
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || ''
}
],
link: [{
rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico'
}]
},
// https://www.cnblogs.com/bgwhite/p/9403285.html
// https://zh.nuxtjs.org/api/configuration-router#base
router: {
// 相对路径打包
base: process.env.NODE_ENV === 'production' && process.env.BASE ? process.env.BASE : '/'
},
env: {
baseUrl: process.env.BASE_URL || 'http://localhost:3000'
},
/*
** Customize the progress-bar color
*/
loading: {
color: '#fff'
},
/*
** Global CSS
*/
css: [
// 'reset-css/reset.css',
'bootstrap/dist/css/bootstrap.min.css',
'./assets/style/_global.scss'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
// { src: "~/plugins/flexible", ssr: false },
'~/plugins/global',
'~/plugins/axios',
'~/plugins/global-components'
],
/*
** Nuxt.js dev-modules
*/
buildModules: [],
/*
** Nuxt.js modules
*/
modules: [
// 使用bootstrap-vue
// 'bootstrap-vue/nuxt',
'@nuxtjs/axios'
],
//https://axios.nuxtjs.org/setup
axios: {
// proxyHeaders: false
retry: {
retries: 3
},
proxy: process.env.NODE_ENV === 'production' ? false : true,
// baseURL: process.env.NODE_ENV === 'production' && process.env.BASE ? 'https://beer.poorman.top' : ''
},
proxy: {
'/api': 'http://gank.io',//'https://beer.poorman.top',
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.resolve.alias['@pages'] = path.resolve(__dirname, 'pages');
config.resolve.alias['@assets'] = path.resolve(__dirname, 'assets');
config.resolve.alias['@components'] = path.resolve(__dirname, 'components');
config.resolve.alias['@images'] = path.resolve(__dirname, 'assets', 'images');
},
postcss: {
// 添加插件名称作为键,参数作为值
// 使用npm或yarn安装它们
plugins: {
// 通过传递 false 来禁用插件
// 'postcss-url': false,
// 'postcss-nested': {},
// 'postcss-responsive-type': {},
// 'postcss-hexrgba': {}
'postcss-pxtorem': {
rootValue: 16,
propList: ['*'],
unitPrecision: 5, //保留小数位
// selectorBlackList: [''], //过滤的类名
// replace: true, //默认直接替换属性
// mediaQuery: false,
minPixelValue: 12 //所有小于设置的样式都不被转换
}
},
preset: {
// 更改postcss-preset-env 设置
autoprefixer: true
}
}
},
serverMiddleware: [
// {path:'/api/auth', handler:'~/api/auth'}
]
}