When I start to run my nuxt project in ie9,I got a problem. console say "[nuxt] Error while initializing appTypeError: 对象不支持“replaceState”属性或方法", it seems not support replaceState.
Is anyone can tell me how to fix it ? !
PS: I have already installed babel-polyfill, and ie9 can run the project few days, but today the problem was appear, even I didn't have change anything! It sounds unbelievable...but it happen
IE9 doesn't support History API, use hash
mode or fallback
.
//nuxt.config.js
module.exports = {
router: {
mode: 'hash',
// or
fallback: true
}
}
@clarkdo vue-router had solved this problem on v3.0.1 [https://github.com/vuejs/vue-router/tree/v3.0.1] . but nuxtjs
is use to the old version v2.7.0 . When will the next version be updated to solve this problem in IE9?
Please refer https://github.com/nuxt/nuxt.js/issues/2142, we're really work hard on the new release. 😸
@djune i have tried upgrade vue-router to v3.0.1, and still got that error.
the way to upgrade it is just delete the package in node_modules and reinstall it, and upgrade other vue packages
@huanyu I resolved by this:
window.history.replaceState = window.history.replaceState || function(){};
@clarkdo Thank you. It helped me a lot. Fallback is a great way to do it.
@djune It helped me a lot in this way
@clarkdo
Do you know what the problem is?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@huanyu I resolved by this:
window.history.replaceState = window.history.replaceState || function(){};