Merge pull request #2932 from Hongarc/parsing

refactor: better parsing name of file
pull/2944/head
Rich Harris 6 years ago committed by GitHub
commit 7b6cd52d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,8 +25,7 @@ function deregisterExtension(extension) {
function registerExtension(extension) { function registerExtension(extension) {
require.extensions[extension] = function(module, filename) { require.extensions[extension] = function(module, filename) {
const name = path.basename(filename) const name = path.parse(filename).name
.slice(0, -path.extname(filename).length)
.replace(/^\d/, '_$&') .replace(/^\d/, '_$&')
.replace(/[^a-zA-Z0-9_$]/g, ''); .replace(/[^a-zA-Z0-9_$]/g, '');

Loading…
Cancel
Save