forked from eslint/eslint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (58 loc) · 2.04 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"use strict";
const webpack = require("webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
/** @type {import("webpack").Configuration} */
module.exports = {
mode: "none",
entry: {
eslint: ["core-js/stable", "regenerator-runtime/runtime", "./lib/linter/linter.js"]
},
output: {
filename: "[name].js",
library: "[name]",
libraryTarget: "umd",
globalObject: "this"
},
module: {
rules: [
{
test: /\.m?js$/u,
loader: "babel-loader",
options: {
presets: [
["@babel/preset-env", {
debug: true, // ← to print actual browser versions
/*
* We want to remove `transform-unicode-regex` convert because of https://github.com/eslint/eslint/pull/12662.
*
* With `>0.5%`, `@babel/[email protected]` prints below:
*
* transform-unicode-regex { "chrome":"49", "ie":"11", "safari":"5.1" }
*
* So this excludes those versions:
*
* - IE 11
* - Chrome 49 (2016; the last version on Windows XP)
* - Safari 5.1 (2011-2013; the last version on Windows)
*/
targets: ">0.5%, not chrome 49, not ie 11, not safari 5.1"
}]
]
}
}
]
},
plugins: [
new webpack.NormalModuleReplacementPlugin(
/^node:/u,
resource => {
resource.request = resource.request.replace(/^node:/u, "");
}
),
new NodePolyfillPlugin()
],
resolve: {
mainFields: ["browser", "main", "module"]
},
stats: "errors-only"
};