Can anyone explain how to implement the shared package feature in Sencha Cmd 5 with ExtJs 5? I created a workspace containing two applications. These applications share javascript code, which was placed in the proper packages folder, and the application's respective app.json was modified as instructed here .
The shared code is not being implemented after running the "sencha app refresh" command. I have been at this for days now. Below are the steps I took to create the workspace, apps and package:
Step 1: Create Workspace
sencha generate workspace ./
Step 2: Create Apps
sencha generate app -ext -path ./testapp1/ -name testapp1
sencha generate app -ext -path ./testapp2/ -name testapp2
Step 3: Create Package Called "common"
sencha generate package -name common
Step 4: Drop basic ExtJs class file in packages/common/src folder
Step 5: Modify app.json code in both applications to include newly dropped ExtJs class
Step 6: Refresh
sencha app refresh
After running refresh, I expect to be able to use the code, or at least reference it using FireBug. Am I missing a step??? Any help would be greatly appreciated.
You basically have it correct. the app.json
file needs to have the requires
property set to include your common
package.
"requires" : [ "common" ]
Then be sure to use requires
on any class in your application to include the source files from your package.
Ext.define('MyApp.foo.Bar', {
requires : [
'Common.Util' //or whatever it's called
],
//...
});
And finally the sencha app refresh
so that the bootstrap paths are correctly updated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.