Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Created August 11, 2019 12:47
Show Gist options
  • Save Weiyuan-Lane/7bf12ef29dedeadc881fb1e645839f35 to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/7bf12ef29dedeadc881fb1e645839f35 to your computer and use it in GitHub Desktop.
Next.js config for inserting configuration environment variables on base path to use throughout the application
const basePath = '/spa-github-page-template'; // or '' if basePath needs to be left unchanged
const webpackBasePath = process.env.SPA_EXP_BUILD === 'true' ? basePath : '';
module.exports = {
publicRuntimeConfig: {
basePath: webpackBasePath,
},
};
@themegabyte
Copy link

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment