vue路由懒加载,小概率404的解决方案

1.resolve => require([URL], resolve),支持性好 
2.() => system.import(URL) , webpack2官网上已经声明将逐渐废除,不推荐使用 
3.() => import(URL), webpack2官网推荐使用,属于es7范畴,需要配合babel的syntax-dynamic-import插件使用。

Installation

npm install --save-dev babel-plugin-syntax-dynamic-import

Copy

Usage

Via .babelrc (Recommended)

.babelrc

http://babeljs.io/docs/en/babel-plugin-syntax-dynamic-import/

{
  "plugins": ["syntax-dynamic-import"]
}

猜你喜欢

转载自blog.csdn.net/qq_31965515/article/details/81736680