Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/discord/babel-plugin-strip-object-freeze
Replace all instances of Object.freeze(value) with value
https://github.com/discord/babel-plugin-strip-object-freeze
babel babel-plugin performance
Last synced: 3 months ago
JSON representation
Replace all instances of Object.freeze(value) with value
- Host: GitHub
- URL: https://github.com/discord/babel-plugin-strip-object-freeze
- Owner: discord
- License: mit
- Created: 2020-04-16T02:06:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T08:25:57.000Z (over 1 year ago)
- Last Synced: 2024-10-01T03:40:56.345Z (3 months ago)
- Topics: babel, babel-plugin, performance
- Language: JavaScript
- Size: 146 KB
- Stars: 10
- Watchers: 9
- Forks: 7
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-strip-object-freeze
> Replace all instances of `Object.freeze(value)` with `value`
If you use `Object.freeze()` a lot in development to enforce constraints, you
may want to use this plugin to strip those `Object.freeze()` calls in production
for performance if they are not important.## Install
```sh
npm install --save-dev babel-plugin-strip-object-freeze
```## Usage
It's recommended that you only use this plugin in a production build.
```js
// babel.config.js
let presets = [ ... ]
let plugins = [ ... ]if (process.env.NODE_ENV === "production") {
plugins.push("babel-plugin-strip-object-freeze")
}module.exports = { presets, plugins }
```## Example
**Input:**
```js
Object.freeze(value)
```**Output:**
```js
value
```