Skip to content

Instantly share code, notes, and snippets.

@flashblaze
Created November 11, 2019 15:02
Show Gist options
  • Select an option

  • Save flashblaze/5a68d0e728bf755c95656905534a5c40 to your computer and use it in GitHub Desktop.

Select an option

Save flashblaze/5a68d0e728bf755c95656905534a5c40 to your computer and use it in GitHub Desktop.
// from here: https://github.com/moxystudio/next-with-moxy/blob/master/next.config.js
require('dotenv').config();
const { withRasterImages, withPlayback, withSVG, withFonts, with3D } = require('@moxy/next-common-files');
const withOneOf = require('@moxy/next-webpack-oneof');
const withCompileNodeModules = require('@moxy/next-compile-node-modules');
const withCSS = require('@zeit/next-css');
const { PHASE_PRODUCTION_BUILD } = require('next/constants');
const withPlugins = require('next-compose-plugins');
module.exports = (phase, nextConfig) =>
withPlugins([
withOneOf,
[withCSS, {
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: phase === PHASE_PRODUCTION_BUILD ?
'[hash:base64:5]' :
'[name]__[local]___[hash:base64:5]',
},
}],
withRasterImages(),
withRasterImages({
include: /\.data-url\./,
options: {
limit: Infinity,
},
}),
withPlayback(),
withPlayback({
include: /\.data-url\./,
options: {
limit: Infinity,
},
}),
withFonts(),
withFonts({
include: /\.data-url\./,
options: {
limit: Infinity,
},
}),
with3D(),
with3D({
include: /\.data-url\./,
options: {
limit: Infinity,
},
}),
withSVG(),
withSVG({
include: /\.data-url\./,
options: {
limit: Infinity,
},
}),
withSVG({
include: /\.inline\./,
inline: true,
}),
withCompileNodeModules(),
], {
compress: process.env.COMPRESSION !== '0',
env: {
GA_TRACKING_ID: process.env.GA_TRACKING_ID,
},
})(phase, nextConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment