From 23004ca4aa6a6575d26c2cef1ec0afcb38275c29 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 18 Mar 2022 12:51:30 +0800 Subject: [PATCH] Simplify test script --- .../bundle-prettier-with-webpack-test/index.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/scripts/tools/bundle-prettier-with-webpack-test/index.js b/scripts/tools/bundle-prettier-with-webpack-test/index.js index a02df100f42f..2d5a53885c58 100644 --- a/scripts/tools/bundle-prettier-with-webpack-test/index.js +++ b/scripts/tools/bundle-prettier-with-webpack-test/index.js @@ -1,6 +1,5 @@ import { fileURLToPath } from "node:url"; import path from "node:path"; -import fs from "node:fs/promises"; import crypto from "node:crypto"; import webpack from "webpack"; import { DIST_DIR } from "../../../scripts/utils/index.mjs"; @@ -33,27 +32,12 @@ const TEMPORARY_DIRECTORY = fileURLToPath(new URL("./.tmp", import.meta.url)); /* `require` in `parser-typescript.js`, #12338 */ (async () => { - try { - await fs.mkdir(TEMPORARY_DIRECTORY); - } catch { - // No op - } - - const relativePath = path - .relative(TEMPORARY_DIRECTORY, DIST_DIR) - .replaceAll("\\", "/"); - const PROBLEMATIC_WARNING_MESSAGE = "Critical dependency: require function is used in a way in which dependencies cannot be statically extracted"; - const inputFile = path.join(TEMPORARY_DIRECTORY, getRandomFileName("input")); - await fs.writeFile( - inputFile, - `import "${relativePath}/parser-typescript.js"` - ); const stats = await runWebpack({ mode: "production", - entry: inputFile, + entry: path.join(DIST_DIR, "parser-typescript.js"), output: { path: TEMPORARY_DIRECTORY, filename: getRandomFileName("output"),