From 473c59b7ad26289ed308090a904ddad665287654 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Mon, 20 Mar 2023 11:38:53 -0400 Subject: [PATCH] Remove now-obsolete import cleanup plugin This was added as part of the "Interaction Tracking" work in #13509 back in 2018. That feature was removed in #20037 in 2020, and this plugin appears to no longer have any effect on the build output. --- scripts/rollup/build.js | 4 --- .../rollup/plugins/strip-unused-imports.js | 29 ------------------- 2 files changed, 33 deletions(-) delete mode 100644 scripts/rollup/plugins/strip-unused-imports.js diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index 46f5ae1a8954c..a0b39dd37f24b 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -18,7 +18,6 @@ const Stats = require('./stats'); const Sync = require('./sync'); const sizes = require('./plugins/sizes-plugin'); const useForks = require('./plugins/use-forks-plugin'); -const stripUnusedImports = require('./plugins/strip-unused-imports'); const dynamicImports = require('./plugins/dynamic-imports'); const Packaging = require('./packaging'); const {asyncRimRaf} = require('./utils'); @@ -430,9 +429,6 @@ function getPlugins( assume_function_wrapper: !isUMDBundle, renaming: !shouldStayReadable, }), - // HACK to work around the fact that Rollup isn't removing unused, pure-module imports. - // Note that this plugin must be called after closure applies DCE. - isProduction && stripUnusedImports(pureExternalModules), // Add the whitespace back if necessary. shouldStayReadable && prettier({ diff --git a/scripts/rollup/plugins/strip-unused-imports.js b/scripts/rollup/plugins/strip-unused-imports.js deleted file mode 100644 index a8b74142d811f..0000000000000 --- a/scripts/rollup/plugins/strip-unused-imports.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -'use strict'; - -module.exports = function stripUnusedImports(pureExternalModules) { - return { - name: 'scripts/rollup/plugins/strip-unused-imports', - renderChunk(code) { - pureExternalModules.forEach(module => { - // Ideally this would use a negative lookbehind: (?