Skip to content

Instantly share code, notes, and snippets.

@pkellner
Created November 11, 2018 21:43
Show Gist options
  • Save pkellner/a2362c22cfd214588b7a4450f59a0a6a to your computer and use it in GitHub Desktop.
Save pkellner/a2362c22cfd214588b7a4450f59a0a6a to your computer and use it in GitHub Desktop.
Sample next.config.js for Next.js that includes environment variables, and other plugins (CSS and Image)
const withCSS = require("@zeit/next-css");
require('dotenv').config()
const path = require('path')
const Dotenv = require('dotenv-webpack')
const withImages = require('next-images')
module.exports = withCSS(withImages({
inlineImageLimit: 16384,
webpack(config, options) {
config.plugins = config.plugins || [];
config.plugins = [
...config.plugins,
// Read the .env file
new Dotenv({
path: path.join(__dirname, '.env'),
systemvars: true
})
];
return config
}
}));
@philindev
Copy link

philindev commented Aug 22, 2020

It is really useful thing, cause I hadn't been solving my problem for 4 days.
Problem was:
Using [name].css with grid-column-end with span 2 inside. After npm run build. Nextjs can't build it for the reason span (special word) was seen as custom css.

Thank u very much :+1

Аннотация 2020-08-22 204601

Аннотация 2020-08-22 204454

@pkellner
Copy link
Author

Great

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