Gathering detailed insights and metrics for babel-plugin-import-global
Gathering detailed insights and metrics for babel-plugin-import-global
Gathering detailed insights and metrics for babel-plugin-import-global
Gathering detailed insights and metrics for babel-plugin-import-global
@wepy/babel-plugin-import-regenerator
A babel plugin to add a global generator import
babel-plugin-import-to-global
traverse import to global declaration
babel-plugin-import-globals
Automatically import a whitelist of modules when they are used
babel-plugin-import-globals-k
Automatically import a whitelist of modules when they are used. This is a bit like setting a global variable, except that it is isolated to your project (it does not affect dependencies or dependents of the module as they will not be running your babel t
a babel plugin that transfrom import vars to global vars
npm install babel-plugin-import-global
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
20 Commits
1 Forks
1 Watchers
10 Branches
2 Contributors
Updated on Jul 29, 2022
Latest Version
0.0.6
Package Id
babel-plugin-import-global@0.0.6
Unpacked Size
22.45 kB
Size
4.96 kB
File Count
5
NPM Version
8.5.0
Node Version
16.14.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
31
a babel plugin that suppport:
1 npm install --save-dev babel-plugin-import-global 2 // or 3 yarn add -D babel-plugin-import-global
1const camelCase = require('camelcase'); 2// babel.config.js 3module.exports = { 4 presets: [ 5 ... 6 ], 7 plugins: [ 8 [ 9 'babel-plugin-import-global', 10 { 11 globals: { 12 antd: 'antd', 13 react: 'React', 14 'react-dom': 'ReactDOM' 15 }, 16 removes: [ 17 'antd.css' 18 ], 19 redirects: [ 20 { 21 from: /^antd-plus\/npm\/components\/([^/]+)$/, 22 to: 'antd-plus', 23 imported: (src, matched) => camelCase(matched[1], { pascalCase: true }) 24 } 25 ] 26 } 27 ], 28 ... 29 ] 30};
1import React from "react"; 2import ReactDOM from "react-dom"; 3import { Search } from 'antd/npm/components/input'; 4import Button from 'antd/npm/components/button'; 5import Input from 'antd/npm/components/input'; 6 7import 'antd.css'; 8 9const Select = require('antd/npm/components/select') 10 11const { Option } = Select; 12 13function Test() { 14 return ( 15 <> 16 <Select> 17 <Option>dd</Option> 18 </Select> 19 <Input /> 20 <Search /> 21 <Button>test</Button> 22 </> 23 ) 24} 25 26 27function test1() { 28 ReactDOM.render(Test, document.getElementById('root')) 29} 30 31export { 32 test1 33} 34 35export default Test; 36
will transform to:
1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.test1 = test1; 7exports["default"] = void 0; 8 9var _antd = require("antd"); 10 11var React = window.React; 12var ReactDOM = window.ReactDOM; 13 14var Search = require("antd").Input.Search; 15 16var Select = require("antd").Select; 17 18var Option = Select.Option; 19 20function Test() { 21 return ( 22 /*#__PURE__*/ 23 React.createElement(React.Fragment, null, 24 /*#__PURE__*/ 25 React.createElement(Select, null, 26 /*#__PURE__*/ 27 React.createElement(Option, null, "dd")), 28 /*#__PURE__*/ 29 React.createElement(_antd.Input, null), 30 /*#__PURE__*/ 31 React.createElement(Search, null), 32 /*#__PURE__*/ 33 React.createElement(_antd.Button, null, "test")) 34 ); 35} 36 37function test1() { 38 ReactDOM.render(Test, document.getElementById('root')); 39} 40 41var _default = Test; 42exports["default"] = _default;
globals
that will transform to global vars. demo:1{ 2 globals: { 3 antd: 'antd' 4 } 5}
or
1{ 2 globals(src) { 3 const map = { 4 antd: 'antd' 5 }; 6 return map[src]; 7 } 8}
removes
that will be removed from code. demo:1{ 2 removes: [ 3 'antd', 4 /some\.css$/, 5 function(src) { 6 return src === 'antd'; 7 } 8 ] 9}
redirects
that will redirect the import source. demo:1{ 2 redirects: [ 3 { 4 // string or Regexp 5 from: /^antd\/npm\/components\/([^/]+)$/, 6 // string or string.repalce`s function 7 to: 'antd', 8 // custom imported handler, optional 9 imported: (src, matched) => camelCase(matched[1], { pascalCase: true }) 10 } 11 ] 12}
namespace
that will transfrom to window.namespace.varName
if provided.
global
default is window
.
varKind
default is var
.
includes
includes files RegExp list.
excludes
excludes files RegExp list.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/16 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More