Skip to content

Commit

Permalink
Merge pull request #446 from thematters/update/nextjs9
Browse files Browse the repository at this point in the history
Upgrade Next.js to 9.x
  • Loading branch information
robertu7 authored Oct 9, 2019
2 parents 384e8ec + d05ccf9 commit f5562d2
Show file tree
Hide file tree
Showing 869 changed files with 4,909 additions and 6,394 deletions.
6 changes: 3 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"plugins": ["styled-jsx-plugin-postcss"]
}
}
],
"@zeit/next-typescript/babel"
]
],
"plugins": [
[
"module-resolver",
{
"alias": {
"~": "."
"~/static": "./public/static",
"~": "./src"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ steps:
- name: tslint
image: node:11.14.0
commands:
- npm run gen:clean # temperally clean
- npm run gen:type
- npm run lint
- npm run format:check
Expand All @@ -29,6 +28,7 @@ steps:
- name: build
image: node:11.14.0
commands:
- cp .env.example .env
- npm run build

# === CI tasks for `develop` branch ===
Expand Down
5 changes: 1 addition & 4 deletions apollo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ module.exports = {
url:
'http://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/graphql'
},
includes: [
'+(pages|views|components)/**/*.{ts,tsx}',
'./common/utils/types/**/*.ts'
]
includes: ['src/**/*.{ts,tsx}']
}
}
2 changes: 1 addition & 1 deletion bin/buildFragmentTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fetch(process.env.API_URL, {
)
result.data.__schema.types = filteredData
fs.writeFile(
'common/gql/fragmentTypes.json',
'src/common/gql/fragmentTypes.json',
JSON.stringify(result.data),
err => {
if (err) {
Expand Down
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
40 changes: 17 additions & 23 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ try {
}

const withPlugins = require('next-compose-plugins')
const withTypescript = require('@zeit/next-typescript')
const withBundleAnalyzer = require('@zeit/next-bundle-analyzer')
const withSize = require('next-size')
const optimizedImages = require('next-optimized-images')
const withOffline = require('next-offline')

Expand All @@ -23,6 +21,7 @@ const nextConfig = {
*
* @see {@url https://github.com/zeit/next.js#exposing-configuration-to-the-server--client-side}
*/
poweredByHeader: false,
serverRuntimeConfig: {
// Will only be available on the server side
},
Expand All @@ -42,6 +41,7 @@ const nextConfig = {
/**
* Build time configs
*/
pageExtensions: ['tsx'],
env: {
app_version: packageJson.version
},
Expand All @@ -66,19 +66,19 @@ const nextConfig = {
/***
* Import files as URL
*/
config.module.rules.push({
test: /\.xml$/,
use: [
{
loader: 'file-loader',
options: {
publicPath: '/_next/static/',
outputPath: `${isServer ? '../' : ''}static/`,
name: '[name]-[hash].[ext]'
}
}
]
})
// config.module.rules.push({
// test: /\.xml$/,
// use: [
// {
// loader: 'file-loader',
// options: {
// publicPath: '/_next/static/',
// outputPath: `${isServer ? '../' : ''}static/`,
// name: '[name]-[hash].[ext]'
// }
// }
// ]
// })

return config
},
Expand All @@ -93,9 +93,6 @@ const nextConfig = {

module.exports = withPlugins(
[
// TypeScript
withTypescript,

// images
[
optimizedImages,
Expand All @@ -114,9 +111,6 @@ module.exports = withPlugins(
}
],

// output build size
withSize,

// bundle analyzer
[
withBundleAnalyzer,
Expand Down Expand Up @@ -146,14 +140,14 @@ module.exports = withPlugins(
runtimeCaching: [
{
urlPattern: '/',
handler: 'networkFirst',
handler: 'NetworkFirst',
options: {
cacheName: 'homepage-cache'
}
},
{
urlPattern: new RegExp('/_next/static/'),
handler: 'cacheFirst',
handler: 'CacheFirst',
options: {
cacheName: 'static-cache',
cacheableResponse: {
Expand Down
Loading

0 comments on commit f5562d2

Please sign in to comment.