admin管理员组文章数量:1426034
I am creating a package for ExtJS 6 where I need to include an external JavaScript file as a resource.
I placed the file in the resources
folder of my package, but I can't seem to find any documentation on how to use Ext.require()
to load this file.
I could use Ext.require(Ext.resolveResource("<@MyPackage>custom")
- that downloads and executes the Sencha/build/production/MyApp/classic/resources/MyPackage/custom.js
but it also plains that it cannot load the class from this file:
[E] [Loader] The following classes failed to load:
[E] [Loader] Sencha/build/production/MyApp/classic/resources/MyPackage/custom from Sencha/build/production/MyApp/classic/resources/MyPackage/custom.js
Can Ext.require()
be used for this purpose or do I have to use Ext.AJAX
and create the <script>
tag by myself?
I am creating a package for ExtJS 6 where I need to include an external JavaScript file as a resource.
I placed the file in the resources
folder of my package, but I can't seem to find any documentation on how to use Ext.require()
to load this file.
I could use Ext.require(Ext.resolveResource("<@MyPackage>custom")
- that downloads and executes the Sencha/build/production/MyApp/classic/resources/MyPackage/custom.js
but it also plains that it cannot load the class from this file:
[E] [Loader] The following classes failed to load:
[E] [Loader] Sencha/build/production/MyApp/classic/resources/MyPackage/custom from Sencha/build/production/MyApp/classic/resources/MyPackage/custom.js
Can Ext.require()
be used for this purpose or do I have to use Ext.AJAX
and create the <script>
tag by myself?
- Have you tried edition app.json? – Dumbledore Commented Jan 26, 2016 at 13:31
- Since I am creating a package, editing app.json seems wrong as it is outside the package code. – Knaģis Commented Jan 26, 2016 at 13:32
- Are you creating a new class or overriding existing classes? – Dumbledore Commented Jan 26, 2016 at 13:34
- new ponents that extend Ext.Component. – Knaģis Commented Jan 26, 2016 at 14:11
-
IMO, you need to add the files as resource in app.json (after the ExtJS bundle, of course), so that you ExtJS can load you package at app start and you can use these class just like an existing class. Second option is that you can use
Ext.Loader
. However, I'd like to know other people's thoughts/opinions as well. – Dumbledore Commented Jan 26, 2016 at 15:37
2 Answers
Reset to default 2Edit app.json and look for js property or add it in case it is not there.
...
"js": [
{
"path": "lib/myExternalLibrary.js",
"includeInBundle": true
},
]
...
reference https://docs.sencha./cmd/6.x/microloader.html#js
Maybe its already to late, but this works for ExtJs6 in your package.json
"js" : [{
"path": "resources/js/OpenLayers.js",
"bundle": true
}]
本文标签: How to require a custom JavaScript file from ExtJS package resources folderStack Overflow
版权声明:本文标题:How to require a custom JavaScript file from ExtJS package resources folder - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745363640a2655409.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论