Created
November 11, 2018 21:43
-
-
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)
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 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 | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
withspan 2
inside. Afternpm run build
. Nextjs can't build it for the reason span (special word) was seen as custom css.Thank u very much :+1