{"library":"babel-plugin-define-patterns","type":"library","category":null,"description":"babel-plugin-define-patterns is a Babel plugin designed to perform build-time constant and expression replacements. It operates directly on the Abstract Syntax Tree (AST) during the Babel compilation process, allowing developers to define arbitrary JavaScript expressions or patterns that are replaced with static values. This functionality is analogous to Webpack's DefinePlugin but is integrated at the Babel transformation level, making it bundler-agnostic. Key use cases include injecting environment variables (e.g., `process.env.NODE_ENV`), build-time flags (e.g., `__DEV__`), or specific build metadata (e.g., `require('currentBuildNumber')`). The current stable version is 1.0.0. As a Babel plugin, its release cadence is typically tied to Babel's ecosystem, though specific information on its own cadence is not provided. Its primary differentiator is its deep integration into the Babel AST transformation, offering fine-grained control over code alteration before bundling.","language":"javascript","status":"active","version":"1.0.0","tags":["javascript","babel","plugin","transform","ast","compile","define","values","patterns"],"last_verified":"Wed May 27","install":[{"cmd":"npm install babel-plugin-define-patterns","imports":["[\"define-patterns\", { /* options */ }]","const definePatterns = require('babel-plugin-define-patterns');","{\n  \"plugins\": [\n    [\"define-patterns\", {\n      \"replacements\": { \"process.env.NODE_ENV\": \"production\" }\n    }]\n  ]\n}"]},{"cmd":"yarn add babel-plugin-define-patterns","imports":[]},{"cmd":"pnpm add babel-plugin-define-patterns","imports":[]}],"homepage":null,"github":"https://github.com/discord/babel-plugin-define-patterns","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/babel-plugin-define-patterns","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/babel-plugin-define-patterns/compatibility"}}