silverwolf-x/project / packages /next /src /next-devtools /shared /webpack-module-path.ts
silverwolf-x's picture
download
raw
764 Bytes
const replacementRegExes = [
/^webpack-internal:\/\/\/(\([\w-]+\)\/)?/,
/^(webpack:\/\/\/|webpack:\/\/(_N_E\/)?)(\([\w-]+\)\/)?/,
]
export function isWebpackInternalResource(file: string) {
for (const regex of replacementRegExes) {
if (regex.test(file)) return true
file = file.replace(regex, '')
}
return false
}
/**
* Format the webpack internal id to original file path
*
* webpack-internal:///./src/hello.tsx => ./src/hello.tsx
* webpack://_N_E/./src/hello.tsx => ./src/hello.tsx
* webpack://./src/hello.tsx => ./src/hello.tsx
* webpack:///./src/hello.tsx => ./src/hello.tsx
*/
export function formatStackFrameFile(file: string) {
for (const regex of replacementRegExes) {
file = file.replace(regex, '')
}
return file
}

Xet Storage Details

Size:
764 Bytes
·
Xet hash:
7537959800f590e3946c37902e8a40c64df4c3c7d91a3dbb11f89eb1ca86c670

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.