-
-
Save timneutkens/0a60e823d37cd67458cfb307e9e25adf to your computer and use it in GitHub Desktop.
Revisions
-
timneutkens revised this gist
Feb 15, 2019 . 1 changed file with 28 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,43 @@ require('dotenv').config(); const withCSS = require('@zeit/next-css'); const path = require('path'); const Dotenv = require('dotenv-webpack'); const withImages = require('next-images'); const withTypescript = require('@zeit/next-typescript'); const withOffline = require('next-offline'); const {PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD} = require('next/constants') //const isProd = process.env.NODE_ENV === 'production'; // RESTURL_SPEAKERS_PROD=https://www.siliconvalley-codecamp.com/rest/speakers/ps // RESTURL_SPEAKERS_DEV=http://localhost:4000/speakers // RESTURL_SPEAKER_PROD=https://www.siliconvalley-codecamp.com/rest/Speakers // RESTURL_SPEAKER_DEV=/speakers /* Without CSS Modules, with PostCSS */ module.exports = (phase) => { const isDev = phase === PHASE_DEVELOPMENT_SERVER const isProd = phase === PHASE_PRODUCTION_BUILD const isStaging = process.env.STAGING === '1' const env = { RESTURL_SPEAKERS: (() => { if(isDev) return '/speakers' if(isProd) return 'https://www.siliconvalley-codecamp.com/rest/speakers/ps' return 'default here' })(), RESTURL_SPEAKER: (() => { if(isDev) return '/speakers' if(isProd) return 'https://www.siliconvalley-codecamp.com/rest/Speakers' return 'default here' })() } return withTypescript( withCSS( withImages( withOffline({ env, //assetPrefix: isProd ? 'http://d30k733rzexkhf.cloudfront.net' : '', inlineImageLimit: 16384, serverRuntimeConfig: { @@ -45,3 +70,4 @@ module.exports = withTypescript( ) ) ); } -
pkellner created this gist
Feb 15, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ const withCSS = require('@zeit/next-css'); require('dotenv').config(); const path = require('path'); const Dotenv = require('dotenv-webpack'); const withImages = require('next-images'); const withTypescript = require('@zeit/next-typescript'); const withOffline = require('next-offline'); //const isProd = process.env.NODE_ENV === 'production'; /* Without CSS Modules, with PostCSS */ module.exports = withTypescript( withCSS( withImages( withOffline({ //assetPrefix: isProd ? 'http://d30k733rzexkhf.cloudfront.net' : '', inlineImageLimit: 16384, serverRuntimeConfig: { // Will only be available on the server side }, publicRuntimeConfig: { BASEURL_DEFAULT: 'https://www.siliconvalley-codecamp.com', RESTURL_SPEAKERS_DEFAULT: 'https://www.siliconvalley-codecamp.com/rest/speakers/ps', RESTURL_SPEAKER_DEFAULT: 'https://www.siliconvalley-codecamp.com/rest/speaker', RESTURL_SESSIONS_DEFAULT: 'https://www.siliconvalley-codecamp.com/rest/sessions', RESTURL_ISLOGGEDIN_DEFAULT: 'https://www.siliconvalley-codecamp.com/rpc/account/isLoggedInMobileApp', LOGINAUTH_URL_DEFAULT: 'https://www.siliconvalley-codecamp.com/rpc/account/Login', LOGOUT_URL_DEFAULT: 'https://www.siliconvalley-codecamp.com/rpc/account/LogOutMobileApp', ISLOGGEDIN_NO_DEFAULT: 'https://www.siliconvalley-codecamp.com/rpc/Account/IsLoggedIn', PUBLIC_URL: '' }, webpack(config, options) { config.plugins = config.plugins || []; config.plugins = [ ...config.plugins, // Read the .env file new Dotenv({ path: path.join(__dirname, '.env'), systemvars: true }) ]; return config; } }) ) ) );