Skip to content

Commit

Permalink
Fix params mistaking at #9900 (#9912)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Dec 16, 2020
1 parent 306d15f commit de88250
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/build/build.js
Expand Up @@ -68,12 +68,12 @@ async function createBundle(bundleConfig, cache, options) {
}

const file = path.join("dist", output);
const content = fs.readFileSync(file, "utf8");

// Files including U+FFEE can't load in Chrome Extension
// `prettier-chrome-extension` https://github.com/prettier/prettier-chrome-extension
// details https://github.com/prettier/prettier/pull/8534
if (target === "universal") {
const content = fs.readFileSync(file, "utf8");
if (content.includes("\ufffe")) {
throw new Error("Bundled umd file should not have U+FFFE character.");
}
Expand All @@ -86,16 +86,15 @@ async function createBundle(bundleConfig, cache, options) {

const prettyBytes = require("pretty-bytes");
const getSizeText = (file) => prettyBytes(fs.statSync(file).size);
const sizeTexts = [getSizeText(file, content)];
const sizeTexts = [getSizeText(file)];
if (
type !== "core" &&
format !== "esm" &&
bundleConfig.bundler !== "webpack" &&
target === "universal"
) {
const esmFile = path.join("dist/esm", output.replace(".js", ".mjs"));
const esmContent = fs.readFileSync(esmFile, "utf8");
sizeTexts.push(`esm ${getSizeText(esmFile, esmContent)}`);
sizeTexts.push(`esm ${getSizeText(esmFile)}`);
}
process.stdout.write(
fitTerminal(output, sizeTexts.join(", ").concat(" "))
Expand Down

0 comments on commit de88250

Please sign in to comment.