All important runner changes have landed upstream. Bug: 358290763 Change-Id: Ib47f6838618e9c0081f60f3b60d52b1ce149b2af Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/WebKit/JetStream/+/7094856 Reviewed-by: Marja Hölttä <marja@chromium.org>
73 lines
2 KiB
JavaScript
73 lines
2 KiB
JavaScript
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
import TerserPlugin from "terser-webpack-plugin";
|
|
import CacheBusterCommentPlugin from "../utils/BabelCacheBuster.mjs";
|
|
import UnicodeEscapePlugin from "@dapplets/unicode-escape-webpack-plugin";
|
|
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
function config({ filename, minify, target }) {
|
|
return {
|
|
entry: "./src/test.mjs",
|
|
mode: "production",
|
|
devtool: "source-map",
|
|
target: ["web", target],
|
|
output: {
|
|
path: path.resolve(__dirname, "dist"),
|
|
filename: filename,
|
|
library: {
|
|
name: "PrismJSBenchmark",
|
|
type: "globalThis",
|
|
},
|
|
libraryTarget: "assign",
|
|
chunkFormat: "commonjs",
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.m?js$/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
options: {
|
|
plugins: [CacheBusterCommentPlugin],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new UnicodeEscapePlugin({
|
|
test: /\.(js|jsx|ts|tsx)$/, // Escape Unicode in JavaScript and TypeScript files
|
|
}),
|
|
new LicenseWebpackPlugin({
|
|
perChunkOutput: true,
|
|
outputFilename: "LICENSE.txt",
|
|
})
|
|
],
|
|
resolve: {
|
|
fallback: {},
|
|
},
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
extractComments: false,
|
|
terserOptions: {
|
|
mangle: minify,
|
|
format: {
|
|
// Keep this comment for cache-busting.
|
|
comments: /ThouShaltNotCache/i,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default [
|
|
config({ filename: "bundle.es6.min.js", minify: true, target: "es6" }),
|
|
config({ filename: "bundle.es6.js", minify: false, target: "es6" }),
|
|
config({ filename: "bundle.es5.min.js", minify: true, target: "es5" }),
|
|
config({ filename: "bundle.es5.js", minify: false, target: "es5" }),
|
|
];
|