function getPlugins(options) {
	const {
		plugins,
		publicPath,
		alias,
		root,
		env,
		minify,
		mode,
		isIIFEWorker = false,
		sourcemap,
		features,
		visualize
	} = options;

	// Plugins are pre-sorted
	let split = plugins.findIndex(p => p.enforce === 'post');
	if (split === -1) split = plugins.length;

	const production = mode === 'build';
	const mergedAssets = new Set();

	return [
		acornDefaultPlugins(),
		...plugins.slice(0, split),
		// Skip injecting a client for iife workers
		!isIIFEWorker && features.preact && !production && prefreshPlugin({ sourcemap }),
		production && htmlEntriesPlugin({ root, publicPath, mergedAssets, sourcemap }),
		externalUrlsPlugin(),
		nodeBuiltinsPlugin({ production }),
		urlPlugin({ inline: !production, root, alias }),
		jsonPlugin({ root }),
		bundlePlugin({ inline: !production, cwd: root }),
		absolutePathPlugin({ root }),
		tsConfigPathsPlugin({ cwd: root }),
		aliasPlugin({ alias }),
		sucrasePlugin({
			typescript: true,
			sourcemap,
			production
		}),
		// Transpile import assertion syntax to WMR prefixes
		importAssertionPlugin({ sourcemap }),
		production &&
			(dynamicImportVars.default || dynamicImportVars)({
				include: /\.(m?jsx?|tsx?)$/,
				exclude: /\/node_modules\//
			}),
		production && publicPathPlugin({ publicPath }),
		sassPlugin({ production, sourcemap, root, mergedAssets }),
		lessPlugin({ sourcemap, mergedAssets, alias }),
		wmrStylesPlugin({ hot: !production, root, production, alias, sourcemap }),
		processGlobalPlugin({
			sourcemap,
			env,
			NODE_ENV: production ? 'production' : 'development'
		}),
		// Nested workers are not supported at the moment
		!isIIFEWorker && workerPlugin(options),
		htmPlugin({ production, sourcemap: options.sourcemap }),
		// Skip injecting a client for iife workers
		!isIIFEWorker && wmrPlugin({ hot: !production, sourcemap: options.sourcemap }),
		fastCjsPlugin({
			// Only transpile CommonJS in node_modules and explicit .cjs files:
			include: /(^npm\/|[/\\]node_modules[/\\]|\.cjs$)/
		}),
		(production || isIIFEWorker) && npmPlugin({ external: false }),
		resolveExtensionsPlugin({
			extensions: ['.ts', '.tsx', '.js', '.cjs'],
			index: true
		}),

		...plugins.slice(split),

		// Apply default loaders to unprefixed paths
		defaultLoaders(),

		production && optimizeGraphPlugin({ publicPath }),
		minify && minifyCssPlugin({ sourcemap }),
		production && copyAssetsPlugin({ root, mergedAssets }),
		production &&
			visualize &&
			(visualizer.default || visualizer)({
				// Don't open in unit tests
				open: process.env.NODE_ENV !== 'test',
				gzipSize: true,
				brotliSize: true
			})
	].filter(Boolean);
}
@param {import("wmr").Options & { isIIFEWorker?: boolean}} options
@returns {import("wmr").Plugin[]}