Created
February 19, 2018 21:02
-
-
Save saitonakamura/643d6f7c4b02f56f5dd962e0d38eaaa5 to your computer and use it in GitHub Desktop.
Next.js on Github Pages
This file contains 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 characters
const webpack = require('webpack') | |
const isProd = (process.env.NODE_ENV || 'production') === 'production' | |
const assetPrefix = isProd ? '/your-repository-name' : '' | |
module.exports = { | |
exportPathMap: () => ({ | |
'/': { page: '/' }, | |
'/page1': { page: '/page1' }, | |
}), | |
assetPrefix: assetPrefix, | |
webpack: config => { | |
config.plugins.push( | |
new webpack.DefinePlugin({ | |
'process.env.ASSET_PREFIX': JSON.stringify(assetPrefix), | |
}), | |
) | |
return config | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment