ExtJS app gives variables undefined error after sencha cmd app build - javascript

We have an existing ExtJS app that works perfectly when not minified or merged into a single bundle file.
After we ran sencha app build command and created a app-all.js file, some screens are not working as before and is giving Error:
Cannot read property 'xxxxx' of undefined.
A sample snippets that gives the above error is:
function(b){
var a=b, c=a.something, d=c.somethingElse;
}
here, it says:
cannot read property something of undefined.
Why does the behavior of the code change after the build?

The issue in my case was that there were some backup files of which had different name but the content was older version of the actual file to be loaded. For example, when application is not minified, say the file getting loaded is root.some.path.OneSampleFile.js. When minified, another File OneSampleFileBackup.js was overwriting OneSampleFile as both the files said
Ext.Define('root.some.path.OneSampleFile')
Trying to figure out if there is any easier way to locate files that have duplicate declarations or to only include files whose ext define path and location matches, in the app-all.js build.

Related

Why does my webpack compiled code have references to coinbase wallet and ethereum?

I was trying to figure out why my compiled js code using webpack had the following error in the console?
Uncaught TypeError: Cannot assign to read only property 'ethereum' of object '#'
When I look at the code that generated the error I see a bunch of references to CoinbaseWalletAPI and Ethereum... It seems to be in a small module called requestProvider.js. Has anyone ran into this before? I have not been able to find any references to this error online. When I looked up that NPM module I found this page(https://www.npmjs.com/package/request-provider), I'm assuming one of my modules in my project is including requestProvider but I do not know which one and I cannot find references in the source code in my node modules folder.

Why is CodeMirror failing with the examples that are part of the downloaded zip file?

I am new to CodeMirror and having difficulty getting it to work -- I am specifically looking to get it to work with Groovy.
The following are the steps I have taken:
Downloaded CodeMirror-master.zip
Unzipped it.
Attempted to open "CodeMirror-master/mode/groovy/index.html"
When I open that file, the Groovy code in that file is not formatted. That file references "lib/codemirror.js". The file structure in the zip file does not contain "codemirror.js" in the "lib" directory. However, it does contain "codemirror.js" in the "src" directory. So, I copied everything from the "src" directory to the "lib" directory and it still doesn't display the formatted code from the example. When I open the Chrome browser developer tools it shows 4 errors, but I am so new to this type of development that I don't know what to do. I don't understand why "CodeMirror is not defined" is being thrown -- I assumed that the example code from CodeMirror would work...
The errors I see are as follows:
Uncaught SyntaxError: Cannot use import statement outside a module (codemirror.js)
Uncaught ReferenceError: CodeMirror is not defined
at matchbrackets.js:10:9
at matchbrackets.js:11:3
Uncaught ReferenceError: CodeMirror is not defined
at groovy.js:10:9
at groovy.js:11:3
Uncaught ReferenceError: CodeMirror is not defined
at index.html:76:20
What took me down the path of trying out the examples was that I was unable to get it running with my own code after trying to follow the instructions and I have been banging my head against this for too long.
Any help would be greatly appreciated.
After banging my head against for too long, I have finally found the answer:
the zip file that is currently being distributed is faulty (ie files are not where they are supposed to be and other files are missing).
I had to use the instructions for downloading it via NPM (ie npm install codemirror), then copy that directory structure to my project.

require is not defined at npm.js:2

Forgive me if this is something simple as my research has come up empty in regards to this specific issue. I am using Bootstrap the most recent release. I have noticed that there is a file that is new from previous releases called npm.js. I am hosting all the Bootstrap files locally on my hosted web server. I call the file like all the others in the head to the full path to the file. In the console I have this error.
npm.js:2 Uncaught ReferenceError: require is not defined
at npm.js:2
Which is referring to this line.
require('../../js/transition.js')`
Which is from this npm.js file that is in the newest Bootstrap
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
I am unfamilar with this so I am not sure why I am getting this error but, how can I surpress this error and fix this issue? Do I even need this file? From what I understand if I am using modals or tooltips etc I need this. Is this correct?
You will need to download/config the missing libraries or requires. I am not sure which libraries you are using.
You can add the missing libraries to your package.json. Then call for npm install.

Stop Webstorm of Displaying Error on hbs! Plugin for require.js

There are two files in my project:
index.js where the following code is
define([ 'exports', 'hbs!./general'], function (exports, generalTemplate) {
});
general.handlebars which is correctly taken by require.js and the hbs! plug-in.
I'm basically using Require.js with Handlebars.js and the https://github.com/SlexAxton/require-handlebars-plugin for automating the creation of templates from files.
It works correctly, but Webstorm 8 (and also 7 before it) doesn't understand the file is correct so it always complains with: Cannot resolve file 'general'. It is the same with every file using that plugin prefix.
I coudln't find where (if it exists) to turn that notification off, because it underlines the entire file, and its parent directories as having errors.
How can I remove this error of being reported?
This notification can't be turned off unfortunately - annotator-level inspections can't be suppressed.
The issue with relative paths resolving when loading plugins for non-js extensions is tracked as WEB-1167, please vote

Haste Haskell->JS compiler does not work on OSX, displaying specific error message when calling hastec

I've tried setting up Haste using the official installation guide. Trying to compile a Hello World produces the following error:
Compiling Main into .
Linking haste-compiler/test.js
Linking Main
Linking GHC.Types
Linking GHC.IO.Handle.Text
hastec: /Users/vhsmaia/.haste/jsmods/base/GHC/IO/Handle/Text.jsmod: openBinaryFile: does not exist (No such file or directory)
I've then tried to compile the portable version. The error is now:
hastec: user error (Haste needs to be rebooted; please run haste-boot
Running haste-boot does not amend the error.
I think the problem you have, is that hastec expects your module to have a Main module. Try renaming your file to Main.hs and add a module Main where declaration to the top of the file.

Categories

Resources