I'm working on a project using Electron and Webpack in which I have three processes: main, renderer and app (app and renderer being children of main). App process is forked from main. Before applying webpack into app process, eveything worked just fine. Now that I'm using webpack to create app's bundle, suddenly the child process doesn't seem to be able to send messages to it's parent process.
While debugging, I've added the following line in app's file:
console.log(process.pid);
And weirdly it prints out undefined. How can a process print it's own PID and print undefined?
Silly mistake. In webpack.app.config.js file, target should be node, but it was electron-main. Changed it and everything worked.
I still don't know why it printed undefined as it's PID, though.
Related
I have a react application created using "create react app rewired". I've installed ts-jest and want to be able to customize Jest. I read the documentation from ts-jest and executed npx ts-jest config:init at the root level of my project to create the initial configuration file. To test that jest is indeed using that configuration file, I wrote the following line console.log(window); in a sample test file and modified the configuration such that testEnvironment is set to "node".
I am expecting the test to fail due to window being undefined, but I am getting the window object back. I tried renaming the file to jest.config.ts and I got the same result.
I did a global search across all the files to see if there's another configuration file somewhere that is overriding my configurations, but there was none found.
What am I doing wrong? I know jest comes pre-packaged with create-react-app (CRA). I would imagine that create-react-app-rewired would only include some wrapper above CRA so where is it getting its configurations from?
I've come to realize that create-react-app-rewired package had nothing to do with this issue since it is simply a wrapper package that exposes a configure-overrides.js file to allow developers to modify the webpack configurations managed by create-react-app.
The jest.config.ts or jest.config.js config file I created had no effect because create react app (CRA) will generate and use its own jest config file underneath the hood.
I discovered this by happenstance while researching on another issue. A comment by dstapleton92 on GitHub helped me draw this conclusion.
Create React App supports overriding SOME of the values via the "jest" property in package.json file. Upon inspecting the jest config factory function in CRA, testEnvironment property is hard coded to "jsdom" and the key is not exposed as part of the list of overridable properties.
This is why the attempts I made were not successful.
I am having quiet a bit of trouble with the boot-clj nREPL. I connect using cider-jack-in in EMACS and then at the top it displays the correct port and on the bottom it shows 'boot.user=>' but I am having trouble loading cljs functions from the '../rpc.cljs' page. In short I don't have any idea how to navigate to that place. I tired using '(load "...")' but I can't even figure out the current working directory. I couldn't find a tutorial on using the Boot REPL anywhere. I have tried it from the command line with 'boot repl' then loading with '(def p (future (boot (dev))))' but still am completely lost.
So in short, could someone help point me in the right direction? I am looking for how to change the current directory, finding the current working directory, and loading functions from a .cljs file.
:::EDIT:::
I found the boot-cljs-repl and tried to hook that up. In a Hoplon/Castra template it is already included in the 'build.boot' file but, after following the directions on their GitHub it still doesn't work. To connect it to the project add the below in the 'build.boot' file, the second part is for the Boot Task 'Dev'
(require
'[adzerk.boot-cljs-repl :refer [cljs-repl cljs-repl-env start-repl]]"
...
...
(reload)
(cljs-repl-env)
(cljs)))
...
And then, you should be able to use cider-jack-in to load the CLJS repl with the commands '(def r (future (boot (dev))))' followed by (start-repl) but whenever I run that I have an error. I have tried cider-jack-in-clojurescript and the one before but it seems to have an error connecting to the CLJS repl.
boot.user> << started Weasel server on ws://127.0.0.1:38456 >>
<< waiting for client to connect ...
java.lang.NullPointerException
at clojure.java.io$make_parents.invokeStatic(io.clj:443)
at clojure.java.io$make_parents.doInvoke(io.clj:438)
I will keep trying different approaches but so far seem stuck.
:::EDIT:::
I figured out the problem some more, if you use '(cljs-repl)' instead of '(cljs-repl-env)' than you can connect with 'cider-connect' after you start 'boot dev' in bash, and then you type '(start-repl)' into the cider repl and it starts a CLJS repl. The problem I am now having is if I try and use the REPL like a Clojure REPL it doesn't quite work. If you press C-c C-c cider just says, if in a .cljs file, that it needs a Clojurescript REPL even though it is.
Cheers,
Hello this questions is having a minimal working example of what Im trying to build.
Im having troubles to run flow-type checker on just simple JS file. Here is how the file looks like
// #flow
import type { Map } from 'immutable';
And I even build a minimal working (NOT working) example with travis running it.
Here is the repository. It's very simple and only has flow and immutable-js dependencies.
https://github.com/RusAlex/immutable-flow
and here is the failed Travis-ci build
https://travis-ci.org/RusAlex/immutable-flow/builds/243260858
Flow reads the package.json to find out about imports, but since you moved your .flowconfig inside your src/ folder, it no longer can. If you include the package.json by adding ../package.json to your [include] you get an interesting error:
src/flow.js:2
2: import { Map } from 'immutable';
^^^^^^^^^^^ This modules resolves to "<<PROJECT_ROOT>>/../node_modules/immutable/package.json", which is outside both your root directory and all of the entries in the [include] section of your .flowconfig. You should either add this directory to the [include] section of your .flowconfig, move your .flowconfig file higher in the project directory tree, or move this package under your Flow root directory.
Finally, adding ../node_modules/immutable/ will help flow resolve everything again.
Alternatively, you could just add .flowconfig to the actual project root. It makes things simpler and seems to be the intended default.
I was creating a customer element using the "Your first Polymer App" templates and I wanted to switch over from the included components folder to a Bower managed install. However, after swapping some URLs I began to receive the following error:
polymer Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
The solution is to change ALL of the file paths over to the Bower install of Polymer at the same time. HTML imports suppress duplicate paths but switching will cause it to load Polymer twice and things break.
Having trouble compiling my libgdx project to html.
Looking at the log I think the problem is;
Copying resources from ../android/assets to war/
C:\TomsProjects\MeshExplorerV2\html\..\android\assets
C:\TomsProjects\MeshExplorerV2\html\assets
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war\assets'
Now it strikes me as slightly odd the second line; As there was no html\assets folder.
The assets folder was in html\war\assets, like the last line complains about.
However, after creating a empty assets folder in html, and manually deleting the contents of html\war\assets I still get the same error.
Theres also a "html\webapp" directory without any assets folder. Not sure if there should be one.
I have tried cleaning/rebuilding from eclipse, as well as randomly also trying Gradle>>Refresh All.
Additionally, the Java version runs just fine.
Any pointers, thanks :)
While not exactly reveling the route of the problem, I noticed it let me compile again as long as I restarted eclipse inbetween.
This infers some file-lock going on, possibly a server still running, allthough nothing but the gwt compile as triggered by me.
Still, restarting is a fine workaround for me as it only takes a minute or two.
ah
Pinned it down: Close your FTP program when compiling - at least CoreFTP was locking the directory. Closing it works every time now.
I had a similar issue where I was getting the following error
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war/assets'
All my files under the html/war/assets directory were read only, re-starting the IDE didn't help. To fix it I needed to change permissions chmod -R 777 html/war/assets (you probably dont need 777).