Babel plugin that transforms eval() calls containing string literals by parsing and compiling the string content at transform time
Overall
score
98%
Build a utility that resolves Babel configuration with environment-specific settings and conditional overrides.
Implement a resolveConfig function that:
Accepts a base configuration object containing Babel options (plugins, presets, etc.)
Accepts an options parameter with optional fields:
env: Object mapping environment names (e.g., "development", "production") to configuration objectsoverrides: Array of override objects, each containing configuration to conditionally applyResolves environment-specific configuration: If options.env contains a key matching the current NODE_ENV, merge that configuration into the base
Applies overrides: Merge all override configurations into the result
Returns the resolved configuration object with all applicable settings merged
When given a base configuration with no options, it returns the base configuration unchanged @test
When NODE_ENV is set and options.env contains a matching key, it merges that environment's configuration @test
When options.overrides is provided, it merges all override configurations @test
When both env and overrides are provided, it merges them in correct order: base → env → overrides @test
@generates
/**
* Resolves Babel configuration with environment-specific overrides
* @param {Object} baseConfig - Base Babel configuration object
* @param {Object} [options={}] - Configuration options
* @param {Object} [options.env] - Environment-specific configuration map (keys are environment names)
* @param {Array} [options.overrides] - Array of override configuration objects
* @returns {Object} Resolved Babel configuration object
*/
function resolveConfig(baseConfig, options = {}) {
// Implementation
}
module.exports = { resolveConfig };Provides configuration loading and resolution APIs.
Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-evaldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10