1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Properly escape the dot character in regexp (#4608)

A follow-up to #4604: the dot in the regexp was not escaped as intended. By default `*` matches greedily, so the results are the same, but the new regexp should be more clear. Sorry for the mistake.
This commit is contained in:
Rafał Ruciński 2018-06-14 19:47:49 +02:00 committed by Tim Neutkens
parent f2c2519159
commit 8889430777

View file

@ -3,7 +3,7 @@ import { readdirSync, existsSync } from 'fs'
export function getChunkNameFromFilename (filename, dev) {
if (dev) {
return filename.replace(/.[^.]*$/, '')
return filename.replace(/\.[^.]*$/, '')
}
return filename.replace(/-[^-]*$/, '')
}