Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Created August 10, 2019 07:48
Show Gist options
  • Save Weiyuan-Lane/87599e61c8cf8875c7b703eb8f910644 to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/87599e61c8cf8875c7b703eb8f910644 to your computer and use it in GitHub Desktop.
Development tools for Next configuration
const withSass = require('@zeit/next-sass');
const path = require('path');
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = withSass({
webpack: function(config) {
config.module.rules.push(
{
test: /\.(jpe?g|png|gif|svg|ico)$/,
use: {
loader: 'url-loader',
options: {
limit: 8192,
fallback: 'file-loader',
name: '[name].[hash:15].[ext]',
},
},
}
);
config.plugins.push(new CompressionPlugin());
config.resolve.alias['@styles'] = path.join(__dirname, 'styles');
config.resolve.alias['@helpers'] = path.join(__dirname, 'helpers');
config.resolve.alias['@images'] = path.join(__dirname, 'images');
return config;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment