diff --git a/packages/replace/README.md b/packages/replace/README.md index 334a0de36..247340c8c 100644 --- a/packages/replace/README.md +++ b/packages/replace/README.md @@ -36,13 +36,17 @@ export default { dir: 'output', format: 'cjs' }, - plugins: [replace({ __buildEnv__: 'production' })] + plugins: [replace({ + __buildEnv__: 'production', + __buildDate__: () => new Date(), + __buildVersion: 15 + })] }; ``` Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). -The configuration above will replace every instance of `__buildEnv__` with `'production'` in any file included in the build. _Note: Values should always be strings. For complex values, use `JSON.stringify`._ +The configuration above will replace every instance of `__buildEnv__` with `'production'` and `__buildDate__` with the result of the given function in any file included in the build. _Note: Values have to be either primitives or functions that return a string. For complex values, use `JSON.stringify`._ Typically, `@rollup/plugin-replace` should be placed in `plugins` _before_ other plugins so that they may apply optimizations, such as dead code removal.