Skip to content

Commit 5ce6767

Browse files
committed
refactor: update code for compliance with new eslint rules
1 parent 4ade95b commit 5ce6767

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ caveats when using webpack 4.x in conjunction with ES modules.
110110

111111
Webpack 4.x does not support `webpack.config` files in ES module format, so if
112112
you set `"type": "module"` in `package.json` then you must mark the
113-
`webpack.config` file as a CommonJS file by naming it `webpack.config.cjs`
114-
(with a `.cjs` extension). Of course, you must also use CommonJS format, for
115-
example:
113+
`webpack.config` file as a CommonJS file by naming it `webpack.config.cjs` (with
114+
a `.cjs` extension). Of course, you must also use CommonJS format, for example:
116115

117116
```js
118117
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
@@ -132,14 +131,14 @@ module.exports = {
132131
};
133132
```
134133

135-
Webpack 4.x also will not discover the `webpack.config` file automatically if
136-
it is named with a `.cjs` extension, so you must specify the path to the
134+
Webpack 4.x also will not discover the `webpack.config` file automatically if it
135+
is named with a `.cjs` extension, so you must specify the path to the
137136
configuration file explicitly when running webpack, for example:
138137
`webpack --config ./webpack.config.cjs`.
139138

140139
Webpack 5.x has none of these caveats. In Webpack 5.x, configuration files may
141-
be in ES Module or CommonJS format, and will be discovered automatically if
142-
they are named with any of `.js`, `.cjs`, or `.mjs` file extensions.
140+
be in ES Module or CommonJS format, and will be discovered automatically if they
141+
are named with any of `.js`, `.cjs`, or `.mjs` file extensions.
143142

144143
## Feedback
145144

test-projects/backward-compatibility-pre-1.1.2-config-cjs/webpack.config.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin").default;
24

35
module.exports = {
@@ -7,7 +9,7 @@ module.exports = {
79
module: {
810
rules: [
911
{
10-
test: /\.tsx?$/,
12+
test: /\.tsx?$/u,
1113
use: "ts-loader"
1214
}
1315
]

test-projects/type-module-config-cjs-import-js/webpack.config.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
24

35
module.exports = {
@@ -7,7 +9,7 @@ module.exports = {
79
module: {
810
rules: [
911
{
10-
test: /\.tsx?$/,
12+
test: /\.tsx?$/u,
1113
use: "ts-loader"
1214
}
1315
]

test-projects/webpack-4-compatibility-type-module/webpack.config.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin").default;
24

35
module.exports = {
@@ -7,7 +9,7 @@ module.exports = {
79
module: {
810
rules: [
911
{
10-
test: /\.tsx?$/,
12+
test: /\.tsx?$/u,
1113
use: "ts-loader"
1214
}
1315
]

0 commit comments

Comments
 (0)