2

We are embarking on our second ExtJs 5 application and would like to share code from the first application. Each application will have a seperate MVC structure. I would like to create something like a "common" app that can be reused between the other applications.

What is the preferred way to do this in ExtJS 5?

NOTE: We use Maven as our build tool and do not want a solution that requires Sencha Cmd.

Tarabass
  • 3,132
  • 2
  • 17
  • 35
Dave
  • 21,524
  • 28
  • 141
  • 221
  • 2
    The preferred way is to use Sencha CMD, and to use [packages](http://docs.sencha.com/cmd/5.x/cmd_packages/cmd_creating_packages.html). I know that's not helpful, which is why this is a comment, not an answer. What you need to do is overlay your web app with the source that you want to reuse. There are lots of ways to do that in Maven, including the ['overlay' option of the WAR plugin.](https://maven.apache.org/plugins/maven-war-plugin/overlays.html). Without knowing more of your customised build setup, I can't offer more explicit advice. – Robert Watkins Jun 30 '15 at 07:14
  • You may not "want a solution that requires Sencha Cmd"... but honestly that's EXACTLY what you're asking for. Robert's link to "packages" is precisely what you need. – arthurakay Jun 30 '15 at 12:19

1 Answers1

0

After 2 days of reading the internet and extjs sources, I believe I have found a way to do this. Most of the credit goes to this answer here.

Bottom line is I put my common ExtJS javascript files in their own directory and instructed the loader where to find them based on a "fake" application name of "common":

Ext.Loader.setConfig({
    enabled : true, // Enable dynamic class loading (should be disabled later for production)
    'disableCaching' : true,
    paths : {
        'common' : '../common' 
    }
});

The advantages of this are that I can use URLs within Spring Security to control access and continue to utilize Eclipse's ability to update a running servlet dynamically whenever I change a javascript file.

Community
  • 1
  • 1
Dave
  • 21,524
  • 28
  • 141
  • 221