Skip to content

Commit

Permalink
refactor: update code for compliance with new eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
djcsdy committed Apr 13, 2022
1 parent 4ade95b commit 5ce6767
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ caveats when using webpack 4.x in conjunction with ES modules.

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

```js
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
Expand All @@ -132,14 +131,14 @@ module.exports = {
};
```

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

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

## Feedback

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

const ResolveTypeScriptPlugin = require("resolve-typescript-plugin").default;

module.exports = {
Expand All @@ -7,7 +9,7 @@ module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
test: /\.tsx?$/u,
use: "ts-loader"
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");

module.exports = {
Expand All @@ -7,7 +9,7 @@ module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
test: /\.tsx?$/u,
use: "ts-loader"
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

const ResolveTypeScriptPlugin = require("resolve-typescript-plugin").default;

module.exports = {
Expand All @@ -7,7 +9,7 @@ module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
test: /\.tsx?$/u,
use: "ts-loader"
}
]
Expand Down

0 comments on commit 5ce6767

Please sign in to comment.