( entry, updateBabelOptions, filename, packageName, bundleType, globalName, moduleType, pureExternalModules, bundle )
| 352 | } |
| 353 | |
| 354 | function getPlugins( |
| 355 | entry, |
| 356 | updateBabelOptions, |
| 357 | filename, |
| 358 | packageName, |
| 359 | bundleType, |
| 360 | globalName, |
| 361 | moduleType, |
| 362 | pureExternalModules, |
| 363 | bundle |
| 364 | ) { |
| 365 | // Short-circuit if we're only building a .d.ts bundle |
| 366 | if (bundleType === CJS_DTS || bundleType === ESM_DTS) { |
| 367 | return [dts({tsconfig: bundle.tsconfig})]; |
| 368 | } |
| 369 | try { |
| 370 | const forks = Modules.getForks(bundleType, entry, moduleType, bundle); |
| 371 | const isProduction = isProductionBundleType(bundleType); |
| 372 | const isProfiling = isProfilingBundleType(bundleType); |
| 373 | |
| 374 | const needsMinifiedByClosure = |
| 375 | bundleType !== ESM_PROD && |
| 376 | bundleType !== ESM_DEV && |
| 377 | // TODO(@poteto) figure out ICE in closure compiler for eslint-plugin-react-hooks (ts) |
| 378 | bundle.tsconfig == null; |
| 379 | |
| 380 | return [ |
| 381 | // Keep dynamic imports as externals |
| 382 | dynamicImports(), |
| 383 | bundle.tsconfig != null |
| 384 | ? typescript({tsconfig: bundle.tsconfig}) |
| 385 | : { |
| 386 | name: 'rollup-plugin-flow-remove-types', |
| 387 | transform(code) { |
| 388 | const transformed = flowRemoveTypes(code); |
| 389 | return { |
| 390 | code: transformed.toString(), |
| 391 | map: null, |
| 392 | }; |
| 393 | }, |
| 394 | }, |
| 395 | // See https://github.com/rollup/plugins/issues/1425 |
| 396 | bundle.tsconfig != null ? commonjs({strictRequires: true}) : false, |
| 397 | // Shim any modules that need forking in this environment. |
| 398 | useForks(forks), |
| 399 | // Ensure we don't try to bundle any fbjs modules. |
| 400 | forbidFBJSImports(), |
| 401 | // Use Node resolution mechanism. |
| 402 | resolve({ |
| 403 | // `external` rollup config takes care of marking builtins as externals |
| 404 | preferBuiltins: false, |
| 405 | }), |
| 406 | // Remove license headers from individual modules |
| 407 | stripBanner({ |
| 408 | exclude: 'node_modules/**/*', |
| 409 | }), |
| 410 | // Compile to ES2015. |
| 411 | babel( |
no test coverage detected