Skip to content

Commit

Permalink
Fixed an issue with process references not being removed correctly …
Browse files Browse the repository at this point in the history
…from the `@xstate/react` UMD bundles (#1756)

* 'rollup-replace' replaces process.env.NODE_ENV declarations.

* rollup-replace is a dependency.

* 'rollup-replace' replaces process.env.NODE_ENV declarations.

* Use the same version of rollup-plugin-replace across the repo

* tweak changeset

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
  • Loading branch information
dimitardanailov and Andarist committed Dec 20, 2020
1 parent 8cd0a56 commit a16a5f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-hotels-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xstate/react': patch
---

Fixed an issue with `process` references not being removed correctly from the UMD bundles.
1 change: 1 addition & 0 deletions packages/xstate-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"rollup": "^1.26.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-typescript2": "^0.25.2",
"ts-jest": "^26.4.0",
Expand Down
9 changes: 8 additions & 1 deletion packages/xstate-react/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import replace from 'rollup-plugin-replace';

function createTSCofig() {
return typescript({
Expand All @@ -23,7 +24,13 @@ function createUmdConfig({ input, output: file, name }) {
'@xstate/react': 'XStateReact'
}
},
plugins: [createTSCofig(), terser({ include: [/^.+\.min\.js$/] })]
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
createTSCofig(),
terser({ include: [/^.+\.min\.js$/] })
]
};
}

Expand Down

0 comments on commit a16a5f2

Please sign in to comment.