Skip to content

Commit 7db3d4b

Browse files
committed
refactor: use the 'String#endsWith' method instead
1 parent 05a5048 commit 7db3d4b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/create-webpack-app/src/generators/loader/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function (plop: NodePlopAPI) {
1717
plop.setHelper("makeLoaderName", (name: string) => {
1818
name = plop.getHelper("kebabCase")(name);
1919

20-
if (!/loader$/.test(name)) {
20+
if (!name.endsWith("loader")) {
2121
name += "-loader";
2222
}
2323
return name;

packages/webpack-cli/src/webpack-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ class WebpackCLI implements IWebpackCLI {
18041804
// Fallback `.cts` to `.ts`
18051805
// TODO implement good `.mts` support after https://github.com/gulpjs/rechoir/issues/43
18061806
// For ESM and `.mts` you need to use: 'NODE_OPTIONS="--loader ts-node/esm" webpack-cli --config ./webpack.config.mts'
1807-
if (!interpreted && /\.cts$/.test(ext)) {
1807+
if (!interpreted && ext.endsWith(".cts")) {
18081808
interpreted = interpret.jsVariants[".ts"];
18091809
}
18101810

0 commit comments

Comments
 (0)