Merge pull request #2932 from Hongarc/parsing

refactor: better parsing name of file
pull/2944/head
Rich Harris 5 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) {
require.extensions[extension] = function(module, filename) {
const name = path.basename(filename)
.slice(0, -path.extname(filename).length)
const name = path.parse(filename).name
.replace(/^\d/, '_$&')
.replace(/[^a-zA-Z0-9_$]/g, '');
@ -46,4 +45,4 @@ function registerExtension(extension) {
registerExtension('.svelte');
registerExtension('.html');
module.exports = register;
module.exports = register;

Loading…
Cancel
Save