1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Updated example with-now-env (#4081)

* New example: with-now-env

* updated the example with-now-env
This commit is contained in:
Luis Fernando Alvarez D 2018-03-31 01:17:21 -05:00 committed by Tim Neutkens
parent 7e67152232
commit b43af823dd

View file

@ -1,3 +1,4 @@
const webpack = require('webpack')
/**
* After the next require you can use process.env to get your secrets
*/
@ -16,12 +17,13 @@ console.log({
*/
module.exports = {
webpack: config => {
config.plugins.forEach(plugin => {
if (plugin.constructor.name === 'DefinePlugin') {
plugin.definitions['process.env.SECRET'] = JSON.stringify(process.env.SECRET)
}
})
config.plugins.push(
new webpack.DefinePlugin({
'process.env.SECRET': JSON.stringify(process.env.SECRET)
})
// Same as above
// new webpack.EnvironmentPlugin(['SECRET'])
)
return config
}
}