How to stop VSCode from auto-skipping Node Internals while debugging - javascript

I'm trying to understand how certain node internal modules work, and wish to deliberately step into the node core while debugging my js files. I've tried setting the skipFiles property in Launch.json to an empty array [""] but VSCode somehow auto-attaches "<node_internals>/**" to it

This works for me:
"skipFiles": [
"!<node_internals>/**"
],

Related

VS Code Debugging problems after last update (1.69.2)

After the last update of VS Code to version 1.69.2 i am not able to debug my nodejs - express, project. I am getting unbound breakpoints when i am adding them. My launch.json file :
{
"configurations": [
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"sourceMaps": false
}
]
}
When i am trying to "troubleshoot the launch configuration" i am getting the error message from vs code : "it looks like your degug session has already ended......" but it is not, it is active.
In my project i am using nodejs - express - javascript mostly (no Typescript thats why i set sourceMaps to false).
I am starting my project with the command :
node --inspect sever.js
and after that i attach by procces the debugger ( to default 127.0.0.1:9229).
Can anyone help me to solve this problem? What has change after the last update and i can't use the degugging of VS Code?
Thanks a lot.
Download a previous version.
Also, disable auto updates from Settings -> Update.
https://code.visualstudio.com/updates/v1_68

VScode sourceMaps detected but not used

Hi everyone !
I'm using VSCode to work on an OpenSource project in monorepo with lerna, and I want to provide a package which contains the tools needed to contribute easily.
In order to do this in a way that seems pretty clean to me, I added my monorepo as a submodule in my workbench package.
Here is a link to my current setup:
https://github.com/Aetherall/accounts-workbench
The main goal of this package is to give to the developper a working debugger configuration, which allows breakpoints and follows the Error stack within the sources of the monorepo packages.
I succeded to make VSCode read my sourcemaps.
Indeed, I switched on the trace options, and I saw in the logs that the .map files were resolved.
But, - and there is my issue - when I trigger an error, instead of leading me to the sources, the debugger just show me the transpiled files...
Here is a sample of my log for one file ( I can provide my whole log if needed to help me )
SourceMaps: sourcemap url parsed from end of generated content:
AuthenticationServicePassword.js.map
SourceMaps.getMapForGeneratedPath: Finding SourceMap for
/home/aetherall/Workspace/github/accounts/accounts-workbench/accounts/packages/Server/Authentication/Password/PasswordService/lib/AuthenticationServicePassword.js by URI:
AuthenticationServicePassword.js.map
SourceMaps.loadSourceMapContents: Reading local sourcemap file from
/home/aetherall/Workspace/github/accounts/accounts-workbench/accounts/packages/Server/Authentication/Password/PasswordService/lib/AuthenticationServicePassword.js.map
here is my debugger config:
{
"type": "node",
"request": "launch",
"name": "Start dev server",
"program": "${workspaceRoot}/config/start.js",
"protocol": "inspector",
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"outFiles": [
"${workspaceRoot}/dist/**/*.js",
"${workspaceRoot}/**/lib/**/*.js",
"!**/node_modules/**/*",
],
"skipFiles": ["${workspaceRoot}/node_modules/**/*", "<node_internals>/**/*.js"],
"smartStep": true,
"trace": "sm"
},
I am using webpack to bundle the workbench package (not the monorepo) and tsc to transpile the typescript packages in javascript with sourceMaps in my monorepo submodule
I can of course add more informations if needed
Thanks for helping me on this one !
I really can't get why sourceMaps arn't used by the debugger ...
If you do have a solution, please give me some explanations on the problem
I found a solution to my issue :
Source Map loader for webpack
this way, the sourcemaps of the files imported and transpiled will be resolved within webpack.
https://github.com/webpack-contrib/source-map-loader

Class constructor PolymerElement cannot be invoked without 'new'

Yesterday my app worked perfectly however when I now do polymer serve -o it opens the app and prints this error in the console.
Class constructor PolymerElement cannot be invoked without 'new'
Clear the Cached files and images from your browser cache.
If you loaded custom-elements-es5-adapter.js, remove it.
Then use $ polymer serve --compile never.
According to this post, this issue is cause because $ polymer serve compiles your code to es5 automatically. The --compile never flag stops $ polymer serve from doing this.
I had a similar Error the other day after moving my Polymer App to v.2.
This helped me:
To work around this, load custom-elements-es5-adapter.js before
declaring new Custom Elements.
Since most projects need to
support a wide range of browsers that don't necessary support ES6, it
may make sense to compile your project to ES5. However, ES5-style
custom element classes will not work with native Custom Elements
because ES5-style classes cannot properly extend ES6 classes, like
HTMLElement.
I build my Polymer App as es5-bundled, and serve it to Android App using WebView.
This problem often appears.
In your polymer.json, add custom-elements-es5-adapter to the excludes array to stop it from being compiled to ES5.
"builds": [
{
"bundle": {
"stripComments": true,
"inlineCss": true,
"sourcemaps": false,
"excludes": [
"bower_components/webcomponentsjs/webcomponents-loader.js",
"bower_components/webcomponentsjs/custom-elements-es5-adapter.js"
]
},
"js": {
"compile": true,
"minify": true
},
"css": {
"minify": true
},
"html": {
"minify": true
},
"addServiceWorker": false
The problem occurs because Custom Elements v1 requires your code to use ES6 syntax. So make sure you don't transpile to anything lower, like ES5.
For anyone running into this using the Parcel bundler like me; by default it compiles your code to ES5 or something, even if you're using Typescript and you've set the tsconfig target to ES6.
The solution is to tell Parcel what browsers you're targeting, so that it knows it doesn't have to transpile to ES5. One way to do it is to add a "browserlist" field in package.json.
I found out about this through this video. For more info I suggest you go watch that.

JSLint - ignoring folder when building in Visual Studio 2015

I want to implement javascript code and style checking with JSLint.
I installed JSLint.NET for Visual Studio.
Now i want to exclude all the javascript files that are included from external libraries like datatables, jquery, .. also my own minified files need to be excluded.
My project configurations are added in the JSLintNet.json file:
{
"version": "2.2.0",
"output": "Error",
"ignore": [
"\\Scripts\\angular-datatables\\plugins\\tabletools\\",
"\\Scripts\\angular-datatables\\plugins\\fixedcolumns\\angular-datatables.fixedcolumns.js",
"\\Scripts\\angular-datatables\\plugins\\fixedcolumns\\angular-datatables.fixedcolumns.min.js"
],
"options": {},
"globalVariables": [],
"runOnBuild": true
}
Whatever path i provide here, is it a folder or a file. The code analysis still keeps running. It is important that i can ignore certain files/ folder for JSLint to be practical.
How can i solve the ignoring of folders and files, perhaps even certain extensions.
I have had this problem and am not certain whether this is the right answer: however, it usually works for me. It seems that JSLint.Net only parses the configuration file on startup; so if you edit JSLintNet.json, quit VisualStudio and restart it.
I'm using Visual Studio 2013, version 12.0.40629.00 with JSLint.Net 2.2.0
Hope this helps.

Instruct Sencha SDK tools to bundle other js files specified in app.json

My app.json file of a Sencha touch 2 application contain.
"js": [
{
"path": "sdk/sencha-touch.js"
},
{"path": "js/mootools-1.2.5-core.js"}, // I want these files to be bundled too
{"path": "js/mootools-1.2.5.1-more.js"}, // <----------+
{"path": "js/soundmanager2-nodebug-jsmin.js"}, // <----+
... // <----+ and there are more.
...
{
"path": "app.js",
"bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */
"update": "delta"
},
Now I see when I invoke sencha app build production It compiles all the sencha classes into a giant app.js file. But all my other classes are just compressed to build directory. They are not concatenated. how can I include them in app.js?
F.A.Q.
Your json file is properly written, right?
A. Yes, app.json is written without any syntax error. The project builds successfully on invoking sencha app build production
After looking at the source code and talking with the devs behind Cmd, it appears that it is currently not possible.
However, because the build file is written in JavaScript, in theory, it wouldn't take much to modify it and add this functionality into Cmd.
You can find the Sencha Touch build file in:
CMD-ROOT/plugins/touch/current/app-build.js
Where CMD-ROOT is the location of the sencha command - which you can find out by using which sencha.
On my system (OSX), the path is:
/Users/Robert/bin/Sencha/Cmd/3.0.0.250/plugins/touch/current/app-build.js
Hopefully this is of some help to you.
Update
It appears that, after talking to another Cmd developer, this actually is possible. There are 2 steps you need to take to make it happen:
1) Add the skipFrameworkFile property into each JS resource you want to bundle. This tells the compiler to not copy the resource when your build your app.
{
"path": "resources/js/jquery.js",
"skipFrameworkFile": true
},
"path": "resources/js/jquery2.js",
"skipFrameworkFile": true
}
2) Require each of the files in your app.js file using the #require tag. This tells the compiler to include each of your files into your app.js file.
//#require resources/js/jquery.js
//#require resources/js/jquery2.js
For SenchaCmd 3.2, rdougan's solution didn't work for me. However, instead of using:
'skipFrameworkFile: true
I used
'x-bootstrap': true
(by looking at SenchaCmd source code) and it worked!
The other steps are the same as rdougan's
Hope this helps. Cheers

Categories

Resources