Skip to content

Instantly share code, notes, and snippets.

@jeffryang24
Forked from elken/next.config.js
Created October 30, 2019 17:16
Show Gist options
  • Select an option

  • Save jeffryang24/d501c08a30fcf9f45dad17f77261d581 to your computer and use it in GitHub Desktop.

Select an option

Save jeffryang24/d501c08a30fcf9f45dad17f77261d581 to your computer and use it in GitHub Desktop.

Revisions

  1. @elken elken revised this gist Jul 29, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion next.config.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,6 @@ const withSass = require('@zeit/next-sass');
    const withImages = require('next-images');
    const withOffline = require('next-offline');

    const { withPlugins } = require('next-compose-plugins');
    const withManifest = require('next-manifest')

    const pipe = (...ops) => ops.reduce((a, b) => (arg) => b(a(arg)));
  2. @elken elken created this gist Jul 29, 2019.
    46 changes: 46 additions & 0 deletions next.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    const withTypescript = require('@zeit/next-typescript')
    const withCss = require('@zeit/next-css')
    const withSass = require('@zeit/next-sass');
    const withImages = require('next-images');
    const withOffline = require('next-offline');

    const { withPlugins } = require('next-compose-plugins');
    const withManifest = require('next-manifest')

    const pipe = (...ops) => ops.reduce((a, b) => (arg) => b(a(arg)));
    const isProd = process.env.NODE_ENV === 'production';

    const manifest = {
    "short_name": "next-offline-test-app",
    "name": "next-offline-test-app",
    "description": "Reproduce a bug to help fix it",
    "dir": "ltr",
    "lang": "en",
    "icons": [
    {
    "src": "favicon.ico",
    "sizes": "64x64 32x32 24x24 16x16",
    "type": "image/x-icon"
    }
    ],
    "start_url": "/",
    "display": "standalone",
    "theme_color": "#ffffff",
    "background_color": "#ffffff"
    }

    const settings = {
    webpack: function (config) {
    return config;
    },
    env: {
    pagePrefix: isProd ? '/dash' : '',
    apiUrl: '<redacted>'
    },
    assetPrefix: isProd ? '<redacted>' : '',
    manifest
    }

    const wrapper = pipe(withManifest, withOffline, withCss, withTypescript, withSass, withImages);

    module.exports = wrapper(settings);