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:
parent
7e67152232
commit
b43af823dd
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue