Skip to content

Instantly share code, notes, and snippets.

@tcelestino
Created April 19, 2019 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcelestino/1e63f93cc4142ba6c27b291a567aed25 to your computer and use it in GitHub Desktop.
Save tcelestino/1e63f93cc4142ba6c27b291a567aed25 to your computer and use it in GitHub Desktop.
webpack file-loader settings to next.js
const staticPrefix = '_next/static/';
{
test: /\.(eot|woff2?|ttf|svg|jpe?g|png|svg|gif|ico)$/,
use: [
{
loader: 'file-loader',
options: {
name: IS_PROD ? '' : '[path][name].[ext]',
publicPath: nextConf.assetPrefix.length
? `${nextConf.assetPrefix}${staticPrefix}`
: `/${staticPrefix}`,
outputPath: './static'
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment