diff --git a/packages/next/src/build/webpack/loaders/css-loader/src/utils.ts b/packages/next/src/build/webpack/loaders/css-loader/src/utils.ts index 0c1455d985ae5..5bea07bcf7a2c 100644 --- a/packages/next/src/build/webpack/loaders/css-loader/src/utils.ts +++ b/packages/next/src/build/webpack/loaders/css-loader/src/utils.ts @@ -216,7 +216,7 @@ function normalizeSourceMap(map: any, resourcePath: string) { // We should normalize path because previous loaders like `sass-loader` using backslash when generate source map newMap.sources = newMap.sources.map((source: string) => { // Non-standard syntax from `postcss` - if (source.indexOf('<') === 0) { + if (source.startsWith('<')) { return source } @@ -297,7 +297,7 @@ function normalizeSourceMapForRuntime(map: any, loaderContext: any) { resultMap.sources = resultMap.sources.map((source: string) => { // Non-standard syntax from `postcss` - if (source.indexOf('<') === 0) { + if (source.startsWith('<')) { return source } diff --git a/packages/next/src/build/webpack/loaders/postcss-loader/src/utils.ts b/packages/next/src/build/webpack/loaders/postcss-loader/src/utils.ts index ea09bd5ef085f..5362598199abf 100644 --- a/packages/next/src/build/webpack/loaders/postcss-loader/src/utils.ts +++ b/packages/next/src/build/webpack/loaders/postcss-loader/src/utils.ts @@ -68,7 +68,7 @@ function normalizeSourceMapAfterPostcss(map: any, resourceContext: string) { // eslint-disable-next-line no-param-reassign newMap.sources = newMap.sources.map((source: string) => { - if (source.indexOf('<') === 0) { + if (source.startsWith('<')) { return source } diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/format-webpack-messages.ts b/packages/next/src/client/components/react-dev-overlay/internal/helpers/format-webpack-messages.ts index 280ecf41b82a2..a1b27a8d29499 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/format-webpack-messages.ts +++ b/packages/next/src/client/components/react-dev-overlay/internal/helpers/format-webpack-messages.ts @@ -118,7 +118,7 @@ function formatMessage( } // Cleans up verbose "module not found" messages for files and packages. - if (lines[1] && lines[1].indexOf('Module not found: ') === 0) { + if (lines[1] && lines[1].startsWith('Module not found: ')) { lines = [ lines[0], lines[1]