[英]Dynamically Load Chunks Based on Route in a Laravel Application
I'm writing an app using Laravel that requires different javascript on each page. 我正在使用Laravel编写一个需要在每个页面上使用不同javascript的应用程序。 So, I decided to use Webpack to split the code on a page-by-page basis.
因此,我决定使用Webpack逐页拆分代码。 For example I have a one chunk for code relating to
mywebsite.com
and another chunk for code relating to mywebsite.com/members/new
and an app.js
for the common modules. 例如,我有一个块用于与
mywebsite.com
相关的代码,另一个块用于与mywebsite.com/members/new
相关的代码,以及一个用于通用模块的app.js
What would be the best way to dynamically require these files based on the url? 基于URL动态要求这些文件的最佳方法是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.