Babel helper functions for inserting module loads
Overall
score
99%
Create a Babel plugin that intelligently injects utility imports based on the target environment's module system. The plugin should detect when specific utility function calls are used and automatically inject the appropriate imports with correct module system settings.
Your plugin should:
safeStringify in the codesafe-json-utilssafeStringify(data) is called, the plugin injects a proper ES6 named import at the top of the file @testsafeStringify(data) is called, the plugin injects a proper CommonJS require @testsafeStringify is called multiple times in the same file, only one import is injected @test@generates
import type { PluginObj } from "@babel/core";
export default function environmentAwareImportPlugin(): PluginObj;Provides helper functions for injecting module imports with environment-aware settings.
Provides the core Babel plugin API and types.
Provides types for AST traversal and NodePath.
Install with Tessl CLI
npx tessl i tessl/npm-babel--helper-module-importsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10