I am using NextJS version 12.1. I'm running my application locally with next dev -p 3030.
I'm trying to debug one node_module library behavior by adding some console.log inside of the module, but this don't change the results in my application. What should I do?
place debugger in the file and then replace dev script
"dev": "NODE_OPTIONS='--inspect' next dev"
then you need to start debug mode in vscode
proof of work:
Related
Created a website using next.js with both backend and frontend in one project.In production it takes so much of time to load a webpage.Next version is 9.3.0.
this is my script.using of scss effects loading time
package.json
"scripts": {
"dev": "ts-node --compiler-options=\"{\\\"module\\\": \\\"commonjs\\\"}\" server/server.ts",
"build": "next build",
"start": "NODE_ENV=production 'ts-node' --compiler-options=\"{\\\"module\\\": \\\"commonjs\\\"}\" server/server.ts"
}
I guess that you are starting your production app using npm run start.
From it, it looks like you are running ts-node on production (which compiles TS on the fly).
It is better to compile server.ts on build step using typescript into dist or something like this, then run node on a js result inside dist folder.
https://github.com/vercel/next.js/issues/12797#issuecomment-629321790
https://github.com/vercel/next.js/issues/12797#issuecomment-660225689
For those curious, this was caused by Windows Defender. Windows Defender was delaying the HMR (to do a scan) because our emitted JavaScript files contained the word eval! That's why macOS was unaffected.
Semantic-UI-React emits debug logs: https://github.com/Semantic-Org/Semantic-UI-React/blob/master/src/modules/Modal/Modal.js#L162
But I don't see them in my browser. I'm using semantic-ui-react 0.76.0. In my local npm version of semantic-ui-react, the debug lines seem to be stripped out. Is there some debug build I need? Or maybe I need to set some webpack configuration?
These logs are accesible only within development build of SUIR, they are striped from any npm build by babel-plugin.
You can import component directly from src with such import:
import Modal from 'semantic-ui-react/src/modules/Modal';
Your builder will build component with all non-transformed code and you will can enable it with browser console:
localStorage.debug = '*'
Also, you we will to make a page reload after this.
Don't do this with your production builds :)
When I run Corda flow tests from IntelliJ, the tests fail with the following errors:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using
another instrumentation method you can ignore this message; otherwise,
please refer to the Getting Started section in the Quasar
documentation.
and
java.lang.IllegalStateException: Missing the '-javaagent' JVM
argument. Make sure you run the tests with the Quasar java agent
attached to your JVM. See https://docs.corda.net/troubleshooting.html
- 'Fiber classes not instrumented' for more details.
How can I fix this?
Corda flows need to be instrumented using Quasar before they are run, so that they can be suspended mid-execution.
To achieve this in IntelliJ, you need to:
Create a run config for your tests
Open the run config and change the VM options to -ea -javaagent:PATH-TO-QUASAR-JAR
In the CorDapp example and templates, quasar.jar is located at lib/quasar.jar, so you'd use -ea -javaagent:../lib/quasar.jar
Alternatively, you can edit the default JUnit run config to use the Quasar javaagent by default, avoiding you having to do this every time you pick a new test to run.
This is a basic error that you get if you don't set Quasar, you need to select your test-> go to Intellij top bar-> Run -> Edit Configurations and then set up like this photo in VM options:
From template readme
We recommend editing your IntelliJ preferences so that you use the Gradle runner - this means that the quasar utils plugin will make sure that some flags (like -javaagent - see below) are set for you.
To switch to using the Gradle runner:
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
Btw, if you face same error in VSCode, you can add
"java.test.config": {
"vmArgs": ["-ea", "-javaagent:../lib/quasar.jar"]
},
to settings.json. The path ../lib/quasar.jar may be different in your project.
I am trying to use Visual Studio Code as an alternative to Webstorm to edit and debug a toy Meteor app. After installing the MeteorHelper extension which is announced as provided "Meteor CLI integration into VSCode" and try to run any Meteor command I get the error msg:
"X is not a meteor project directory, check your workspace definition".
I don't know whether the problem is the LOCATION of my directory X, or its CONTENT (something is missing?). I changed the meteorhelper.relativeProjectPath string in the settings.json file to various possible values to no avail.
Has anyone out there tried to use VSCode to edit and debug a Meteor app and got that error?
A Meteor project directory is what gets created when using the command:
meteor create my-app
This command creates a folder that contains your Meteor applications' code. Typically, the directory structure looks something like this:
my-app/
.meteor/
client/
imports/
server/
package.json
The error you're describing would be encountered while attempting to run a project-specific meteor command from outside of a Meteor project. In the above example, I would access the project directory by first entering
cd my-app
on the command line.
I cant get SpringBoot autorestart get to work. I simply create http://start.spring.io/ Gradle project with DevTools selected and run 'gradle eclipse' to create eclipse project and 'gradle bootRun' and now I can do some change in project in Eclipse and this doesnt trigger auto restart at all. There is no message in bootRun console, no change detection. Any idea whats wrong here? I tried several times making starter project with http://start.spring.io and no way with auto restart ...
https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3
Gradle in Eclipse and Gradle on the command line use different directories for their compiled classes. The dev tools (launched via bootRun) will be looking in build/classes whereas Eclipse will be compiling your changes into bin/classes. Rather than launching your app using gradle bootRun, try launching it in Eclipse instead using Run As -> Java application.
In one terminal:
gradle build --continuous
In second terminal:
gradle bootRun
Reference: https://dzone.com/articles/continuous-auto-restart-with-spring-boot-devtools
BTW, I find it take longer time than the eclipse.