getPlugins() — react Function Reference
Architecture documentation for the getPlugins() function in build.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 67c68ebd_67d3_ae9b_4fd2_ce22eb678392["getPlugins()"] c80a1a72_0983_3915_42ad_1026a11c0a09["build.js"] 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 -->|defined in| c80a1a72_0983_3915_42ad_1026a11c0a09 bb9629f0_8ad3_5155_4bf4_2cb0aa60d724["createBundle()"] bb9629f0_8ad3_5155_4bf4_2cb0aa60d724 -->|calls| 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 aa87d6da_515b_1cc2_3ffd_e8382fbe791f["isProductionBundleType()"] 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 -->|calls| aa87d6da_515b_1cc2_3ffd_e8382fbe791f 1e6f68c9_edd9_9b40_828d_221bec05a2f7["isProfilingBundleType()"] 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 -->|calls| 1e6f68c9_edd9_9b40_828d_221bec05a2f7 57691b08_3c9d_40fe_9288_af857c874d77["forbidFBJSImports()"] 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 -->|calls| 57691b08_3c9d_40fe_9288_af857c874d77 7bbc1c59_9f57_47d3_8dcc_d34af876428a["getBabelConfig()"] 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 -->|calls| 7bbc1c59_9f57_47d3_8dcc_d34af876428a style 67c68ebd_67d3_ae9b_4fd2_ce22eb678392 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/rollup/build.js lines 354–546
function getPlugins(
entry,
updateBabelOptions,
filename,
packageName,
bundleType,
globalName,
moduleType,
pureExternalModules,
bundle
) {
// Short-circuit if we're only building a .d.ts bundle
if (bundleType === CJS_DTS || bundleType === ESM_DTS) {
return [dts({tsconfig: bundle.tsconfig})];
}
try {
const forks = Modules.getForks(bundleType, entry, moduleType, bundle);
const isProduction = isProductionBundleType(bundleType);
const isProfiling = isProfilingBundleType(bundleType);
const needsMinifiedByClosure =
bundleType !== ESM_PROD &&
bundleType !== ESM_DEV &&
// TODO(@poteto) figure out ICE in closure compiler for eslint-plugin-react-hooks (ts)
bundle.tsconfig == null;
return [
// Keep dynamic imports as externals
dynamicImports(),
bundle.tsconfig != null
? typescript({tsconfig: bundle.tsconfig})
: {
name: 'rollup-plugin-flow-remove-types',
transform(code) {
const transformed = flowRemoveTypes(code);
return {
code: transformed.toString(),
map: null,
};
},
},
// See https://github.com/rollup/plugins/issues/1425
bundle.tsconfig != null ? commonjs({strictRequires: true}) : false,
// Shim any modules that need forking in this environment.
useForks(forks),
// Ensure we don't try to bundle any fbjs modules.
forbidFBJSImports(),
// Use Node resolution mechanism.
resolve({
// `external` rollup config takes care of marking builtins as externals
preferBuiltins: false,
}),
// Remove license headers from individual modules
stripBanner({
exclude: 'node_modules/**/*',
}),
// Compile to ES2015.
babel(
getBabelConfig(
updateBabelOptions,
bundleType,
packageName,
!isProduction,
bundle
)
),
// Remove 'use strict' from individual source files. We skip eslint-plugin-react-hooks because
// it bundles compiler-type code that may examine "use strict" used outside of a directive
// context, e.g. as a StringLiteral.
bundle.name !== 'eslint-plugin-react-hooks'
? {
name: "remove 'use strict'",
transform(source) {
return source.replace(/['"]use strict["']/g, '');
},
}
: false,
// Turn __DEV__ and process.env checks into constants.
replace({
preventAssignment: true,
values: {
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getPlugins() do?
getPlugins() is a function in the react codebase, defined in scripts/rollup/build.js.
Where is getPlugins() defined?
getPlugins() is defined in scripts/rollup/build.js at line 354.
What does getPlugins() call?
getPlugins() calls 4 function(s): forbidFBJSImports, getBabelConfig, isProductionBundleType, isProfilingBundleType.
What calls getPlugins()?
getPlugins() is called by 1 function(s): createBundle.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free