Open1
Uncaught SyntaxError: Identifier [VARIABLE_NAME] has already been declared の解決法

エラーコード
Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/hoge/piyo/dir_name/src/bld_dir/assets/js/_common/asyncTransition/AsyncTransition.js: Identifier 'VARIABLE_NAME' has already been declared.
エラー内容「変数がすでに宣言されているよ!」
AsyncTransition.js
// *--before
page.exit((context, next) => {
var hash, pageY;
const hash = location.hash;
const pageY = window.scrollY || window.pageYOffset;
history.replaceState({
path: location.pathname + hash,
pageY
}, document.title, location.pathname + hash);
next();
});
this._initPageRouting();
}
// *--after
page.exit((context, next) => {
// var hash, pageY;
const hash = location.hash;
const pageY = window.scrollY || window.pageYOffset;
history.replaceState({
path: location.pathname + hash,
pageY
}, document.title, location.pathname + hash);
next();
});
this._initPageRouting();
}
var の行をコメントアウトして解決