Skip to content

Commit

Permalink
[core] List environment variables used when building static bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Dec 6, 2019
1 parent 8e71dad commit 115a770
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@sanity/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@sanity/server": "0.146.0",
"@sanity/util": "0.146.0",
"@sanity/uuid": "0.146.0",
"@sanity/webpack-integration": "0.146.0",
"batch-stream-operation": "^1.0.2",
"chokidar": "^2.0.3",
"configstore": "^3.0.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/@sanity/core/src/actions/build/buildStaticAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fse from 'fs-extra'
import rimTheRaf from 'rimraf'
import filesize from 'filesize'
import {promisify} from 'es6-promisify'
import webpackIntegration from '@sanity/webpack-integration/v3'
import getConfig from '@sanity/util/lib/getConfig'
import {getWebpackCompiler, getDocumentElement, ReactDOM} from '@sanity/server'
import sortModulesBySize from '../../stats/sortModulesBySize'
Expand Down Expand Up @@ -40,6 +41,16 @@ export default async (args, context) => {

checkStudioDependencyVersions(workDir)

const envVars = webpackIntegration.getSanityEnvVars({env: 'production', basePath: workDir})
const envVarKeys = Object.keys(envVars)
if (envVarKeys.length > 0) {
output.print(
'\nIncluding the following environment variables as part of the JavaScript bundle:'
)
envVarKeys.forEach(key => output.print(`- ${key}`))
output.print('')
}

const compiler = getWebpackCompiler(compilationConfig)
const compile = promisify(compiler.run.bind(compiler))
let shouldDelete = true
Expand Down

0 comments on commit 115a770

Please sign in to comment.