From 08f2ca68fac27996e382a3fe97569b517be9a020 Mon Sep 17 00:00:00 2001 From: Hongarc Date: Sun, 2 Jun 2019 16:41:19 +0700 Subject: [PATCH] refactor: better parsing name of file --- register.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/register.js b/register.js index f5cbeb506393..3278c1cbf5cb 100644 --- a/register.js +++ b/register.js @@ -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; \ No newline at end of file +module.exports = register;