diff --git a/.changeset/pretty-hotels-rush.md b/.changeset/pretty-hotels-rush.md new file mode 100644 index 0000000000..4123c08910 --- /dev/null +++ b/.changeset/pretty-hotels-rush.md @@ -0,0 +1,5 @@ +--- +'@xstate/react': patch +--- + +Fixed an issue with `process` references not being removed correctly from the UMD bundles. diff --git a/packages/xstate-react/package.json b/packages/xstate-react/package.json index 96a85512c8..01c8166cc0 100644 --- a/packages/xstate-react/package.json +++ b/packages/xstate-react/package.json @@ -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", diff --git a/packages/xstate-react/rollup.config.js b/packages/xstate-react/rollup.config.js index 155b288c35..8e75a18e7b 100644 --- a/packages/xstate-react/rollup.config.js +++ b/packages/xstate-react/rollup.config.js @@ -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({ @@ -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$/] }) + ] }; }