Skip to content

Commit

Permalink
fix(babel): allow for preserving build env
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Sep 23, 2017
1 parent 81f4e0f commit 3d4b174
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"add-contributor": "node src contributors add",
"test": "node src test",
"test:update": "node src test --updateSnapshot",
"build": "node src build",
"build": "cross-env BUILD_PRESERVE=true node src build",
"lint": "node src lint",
"format": "node src format",
"validate": "node src validate",
Expand Down
4 changes: 3 additions & 1 deletion src/config/babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const isUMD = process.env.BUILD_FORMAT === 'umd'
const isWebpack = parseEnv('BUILD_WEBPACK', false)
const treeshake = parseEnv('BUILD_TREESHAKE', isRollup || isWebpack)
const alias = parseEnv('BUILD_ALIAS', isPreact ? {react: 'preact'} : null)
const preserveBuildEnv = parseEnv('BUILD_PRESERVE', !isTest)
console.log(process.env.BUILD_PRESERVE)

const envModules = treeshake ? {modules: false} : {}
const envTargets = isTest
Expand All @@ -20,7 +22,7 @@ module.exports = {
ifAnyDep(['react', 'preact'], require.resolve('babel-preset-react')),
].filter(Boolean),
plugins: [
isTest ? null : require.resolve('./babel-plugin-env-build'),
preserveBuildEnv ? null : require.resolve('./babel-plugin-env-build'),
require.resolve('babel-macros'),
isRollup ? require.resolve('babel-plugin-external-helpers') : null,
// we're actually not using JSX at all, but I'm leaving this
Expand Down

0 comments on commit 3d4b174

Please sign in to comment.