How to bundle js/css in legacy java web application

556 Views Asked by At

We have some older java web app's which are struts mvc based and we are using Maven for our build. We are looking into ways of bundling the static content such as js, css etc.

Ideally what we want is, all of our js files get bundled into one, similarly css files as well. And when we run the webapp browser will need one or may be few js rather than 100's of js files. And we will want to add hash to the name of the bundled js and set a long cache expiry.

We are going the route of webpack, but facing lot of issues with the bundled file. We are using yui, yowl js libraries. When we bundle the js, and create a dist/bundle.js and update our jsp to use bundle.js we see bunch of errors.

Ex: TypeError: YAHOO.AjaxPanel is not a constructor

Still trying to understand webpack, it does add bunch of modules, does minification and compression. Is their a way we can just concat multiple js files into one without modularization/minification/compression? I think webpack is converting into modules and what not and seems to comples for what i'm trying to achieve. May be it is more suited for today's js frameworks.

I'm looking into ways to make this work with webpack, if at all possible?

EDIT: Are their any other easy way for what i'm trying to achieve for older web apps?May be concat js files using maven?

1

There are 1 best solutions below

0
Maverick Riz On BEST ANSWER

Used webpack-dev-server to debug into the js issues and resolved those issues.