Skip to content

Instantly share code, notes, and snippets.

@joaocarvalhowd
Created May 5, 2018 19:33
Show Gist options
  • Save joaocarvalhowd/945a9128fc32cd1645d06d6f2e6b59dd to your computer and use it in GitHub Desktop.
Save joaocarvalhowd/945a9128fc32cd1645d06d6f2e6b59dd to your computer and use it in GitHub Desktop.
nuxt.config.js
module.exports = {
debug: true,
build: {
extend (config) {
config.externals = {
newrelic: true
}
const vueLoader = config.module.rules.find((module) => {
return module.test.toString() === '/\\.vue$/'
})
config.module.rules.forEach((rule) => {
if (rule.test.toString() === '/\\.(png|jpe?g|gif|svg)$/') {
rule.test = /\.(png|jpe?g|gif)$/
}
})
config.module.rules.push({
test: /\.svg$/,
use: [
{ loader: 'svg-sprite-loader' },
'svgo-loader'
]
})
},
vendor: [
'axios',
'vue-cookie',
'vue-youtube',
'vue-on-click-outside',
'es6-promise',
'es6-object-assign'
],
postcss: [
require('postcss-cssnext')({
browsers: ['last 2 versions', 'safari 5', 'ie 11', 'opera 12.1', 'iOS >= 7', 'Android >= 4']
})
]
},
head: {
meta: [
{ name: 'format-detection', content: 'telephone=no'}
],
script: [
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' },
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js' }
],
link: [
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css?family=Lato:400,700|Montserrat:400,700'
},
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
plugins: [
{ src: '~/plugins/swiper.js', ssr: false },
{ src: '~/plugins/infinite-scroll.js', ssr: false },
{ src: '~/plugins/cookie.js', ssr: false },
{ src: '~/plugins/youtube.js', ssr: false },
{ src: '~/plugins/clickOutside.js', ssr: false },
{ src: '~plugins/vee-validate.js', ssr: true },
{ src: '~plugins/vue-perf-devtool.js', ssr: true }
],
css: [
'swiper/dist/css/swiper.css'
],
/*
** Customize the progress-bar color
*/
loading: { color: '#007f97' },
/*
** Customize app manifest
*/
manifest: {
theme_color: '#007f97',
short_name: 'e-lens',
name: 'e-lens',
start_url: '/'
},
/*
** Modules
*/
modules: [
'@nuxtjs/pwa',
'@nuxtjs/component-cache',
['~/modules/google-tag-manager', { id: '' }]
],
render: {
static: {
maxAge: '1y',
setHeaders (res, path) {
if (path.includes('sw.js')) {
res.setHeader('Cache-Control', 'public, max-age=0')
}
}
},
http2: {
push: true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment