Intellij javascript debugger can not find debugged sources - javascript

I have a project with Java REST backend and HTML + JavaScript frontend, and I'm trying to debug the JavaScript part.
My project is build with maven and deployed as an exploded war. The debugging works fine only if I put the breakpoints in javascript files residing in "target" folder, e.g the folder that the project compile output goes to.
How can I configure the Javascript debugger with where my scripts are?

Related

External JS on Angular 7 project and Spring

Hi im using Angular 7 and Spring framework, and i need to run a external JS function in TS file.
I tested on a single Angular application and it works well, when i compile the Angular code and put the result on spring resources and generate war file the script is not recognized, the console in browser shows "function undefined".
I modified Angular.json file setting the path of the script in "scripts" section, even if i set in index.html < script src="path/to/script2run.js"> it doesn´t works.
How can i load in spring application my JS file?
Can you help me please?
Regards
Where do you keep your JS file?
If it's working when you run with ng serve it should work when it's compiled as well.
So I think issue in the path. Try to see if this file is coming together with your intex.html.
You can do in Chrome browser:
right click -> inspect -> Network and refresh the page and you will see all files coming from server side to browser. If your JS file is not there than it's path issue make sure your js file is exist from where you are trying to get it.

How to minify, bundle and then publish a TypeScript/React single-page web app project with Visual Studio CE 2019

We have a single-page web app project setup in Visual Studio CE 2019 that is developed in TypeScript using React and LESS, and have been using the Publish feature of Visual Studio to publish to a folder that we then copy to our deployment site. We have a batch script that will re-build the project, perform the publishing, and then copies to published files to the deployment site, so everything is automatable from the command prompt.
Now, the project doesn't currently use any bundling or minification, but we're looking to add this.
The question is: how do you set this up nicely in Visual Studio CE 2019 (we're not using VS Code)?
Our index.html page contains this line for the main start point of the app (app.ts is the main file):
<script src="scripts/require.js" data-main="scripts/app"></script>
We already tried a few things:
In the Project Settings under the TypeScript Build tab, you can set "Combine JavaScript output into file" to for example "scripts/app.js" and you end up with a single app.js file containing all your transpiled TypeScript code. When I run the app from Visual Studio, the app appears to work.
However, if I then do Build --> Publish to publish the site (which also copies all other relevant files, like 3rd party .js files, image assets, static files, favicon, etc...), then all .ts files still get transpiled to indiviual .js files which still get published to the output folder, so that's no good...
We also added the "Bundler & Minifier" extension by Mads Kristensen so we can get minification as well. So I added app.js as the single file to minify, and when we now build the project, we get 1 app.js file (bundled transpiled TypeScript code) and 1 app.min.js file (minified version of app.js).
I then adjusted the last line in our index.html page to <script src="scripts/require.js" data-main="scripts/app.min"></script> to use the minified version app.min.js, but now the app doesn't seem to load nor run any longer...
The bundleconfig.json file currently contains this:
[
{
"outputFileName": "scripts/app.min.js",
"inputFiles": [
"scripts/app.js"
]
}
]
Has anyone managed to setup bundling & minification in Visual Studio CE 2019? Preferably in a way that the Publish functionality also works as expected?
Any help appreciated!

Can't get any files in the Content & Script folder to load in C# ASP.NET MVC application in VS

Having some problems here with a web application that was checked into a code repository.
Basically, this application in particular will not display any images, .js, or .css which are all located in the Content & Script folders. Only the raw HTML shows while running. This occurs specifically after doing a fresh pull from our code repository and running locally through Visual Studio. When you inspect the files in the console when its running, all the files are completely empty. The console is also giving a ERROR 500 error file not found (IIRC) The files are definitely in the project locally and they are showing in the Solution Explorer.
I am the only one who actively works on development for this application and I don't run into these problems with my machine. When you pull from the code repository on another computer, the problems start. However, no other applications with an extremely similar architecture have this problem after pulling fresh for the repository. I tried creating brand new web applications with exact same settings and files on the computers affected and they loaded perfectly.
The link to the file looks normal too, it matches with the production server which works.
The application is using bundles and most of the bundles look like this:
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.min.js",
"~/Scripts/bootstrap-datepicker.min.js",
"~/Scripts/bootstrap-timepicker.js",
"~/Scripts/bootstrap-confirmation.js",
"~/Scripts/respond.js",
"~/Scripts/bootstrap-select.min.js"));`
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.min.css",
"~/Content/bootstrap-datepicker.min.css",
"~/Content/bootstrap-timepicker.css",
"~/Content/bootstrap-sortable.css",
"~/Content/site.css",
"~/Content/bootstrap-select.min.css"));
Things I have tried:
Adding the .js and .css files in _Layout.cshtml page manually instead
of with bundle.
Replacing all the normal files with .min.js or .min.css and vice
versa
Changing authentication methods for access
Changing permissions on Content Folder
Recreating virtual directory
Using Visual Studio 2017 and 2019
I am stumped, anyone have any suggestions or recommendations? I can answer any questions that arise.
You'll need to commit/push .csproj file as well, this file has link to all your files in the project.

Linked javascript file in Visual Studio 2015 not being included in build/deploy

I have a bunch of Javascript files in a centralized project in my solution that I would like to share amongst other projects. However, when building and testing a project with such a linked file, it is 404 when I try to access it in testing my solution.
The script is linked to from the standard Scripts directory in my project - nothing unusual in it's placement. It doesn't get loaded in my view (#Scripts.Render("~/Scripts/Models/InteractionDetails.js")), though the script tag for it does appear in the source and all the other JS files get loaded including a test non-linked js file in the same subdirectory.
How might I get the dratted thing to be properly deployed to the server on build?
This is not a duplicate, as I am using the method outlined to include the files in my project from another project. The issue is that they are not being used when I build the project (eg, I cannot path to the JS files directly on the server, and they are not included in pages referencing them).

Cannot compile javascript files in NetBeans using Rhino

My goal is to create a project (don't know yet if it has to be html5 or java project) in netbeans, add js file with any line of code and then press compile it and run.
I wuld like to have my js files compile to *.class files as it can be done via js console according to rhino tutorial on mozilla page.
But as i said i would like to have it via pressing run/compile button in my netbeans
Currently i'm using netbeans 7.3(i'm honestly open to change version if necesarry) and windows
I already try to do many things but only 2 are worth describing:
-edit build.xml file to use js.jar from rhino
-just run java project with javascript files - according to some articles it should be possible but in my case in just left js files uncompiled
Please help
Aleksandra

Categories