Error building Angular Library : Cannot read property 'toString' of undefined - angular8

I have created a custom library to be used in my main angular application...
However, when I try to build the library using ng build lib-name I am getting the error:
**Cannot read property 'toString' of undefined**.
I could not find an exact solution to get rid of this error.
Any suggested actions?
Some reference information:
Angular CLI: 8.3.5
Node: 10.16.3
OS: win32 x64
Angular:
...
Package Version
#angular-devkit/architect 0.803.5
#angular-devkit/core 8.3.5
#angular-devkit/schematics 8.3.5
#schematics/angular 8.3.5
#schematics/update 0.803.5
rxjs 6.4.0

For me, I get this because I prefer inline templates and styles but I forget to include -s -t flags when using ng generate (especially in lib projects where the global inline settings in angular.json don't seem to stick?).
After I do an ng generate I delete the foo.html and foo.scss files to avoid going into a trance while alt-tabbing 20 times in 5 seconds.
Then, I change templateUrl to template: <p>foo works</p> (note: replace the single quotes from the url string with the template's tickmarks).
I then often forget to change the styleUrl['foo.scss'] to styles:[``] and then this error message pops up. This is quite a lame error message from a great tool but I thinks it has something to do with the opacity of webpack.

Related

Build iohook from source (with electron 4.0.0 and vue)

I used vue-cli to create a vue app and then i added electron(4.0.0) via a plugin called vue-cli-plugin-electron-builder. Everything is ok and works properly.
The problem is with iohook which, as stated on their documentation, has prebuild versions for electron ABI <= 57 (in reality it's <= 64). It seems that on my project it automatically downloads and uses electron ABI(64) which is electron(3.0.0) (verified with node-abi).
electron(4.0.3/4) is ABI(69) (which is not supported). Judging by these circumstances i'm also considering that electron 4.0.0 has ABI(69) as well
iohook needs things specified in package.json [arch type, etc..] which i did specify.
iohook also wants me to npm run build but as of now it doesn't generate any build folder what so ever.
My solutions are:
Go back to electron 3.0.0
What are the differences between electron 3.0.0 and electron 4.0.x
Manually build iohook from source
Their documentation on manual building seems poor, at least for me. How do i actually do that? It's always throwing me errors / saying to cd in the lib's directory and npm run compile which doesn't work because arch type doesn't match.
As of now i want to manually build iohook.
UPDATE
I tried with electron 3.0.0 (barebones) and it's still throwing:
Error: Cannot find module 'F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\builds\electron-v64-win32-x64\build\Release\iohook.node'
at webpackEmptyContext (webpack:///./node_modules/iohook_sync?:2:10)
at eval (webpack:///./node_modules/iohook/index.js?:10:80)
at Object../node_modules/iohook/index.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:252:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///./src/background.js?:15:16)
at Module../src/background.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1395:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///multi_./src/background.js?:1:18)
at Object.0 (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1406:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
UPDATE 2
Doesn't work with electron 2.0.0 either...
I also added the cmake-js thing in package.json
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "2.0.0"
}
Tried electron-rebuild -f -w iohook as well, didn't solve the problem either
Support for Electron v2+ is here now (try iohook version 0.4+). We are currently working on the Win32/64 support for electron 4. All other platforms are fine. You can follow the debug here : https://github.com/wilix-team/iohook/pull/157

PixiJS for Haxe won't import - Type Not Found error in IntelliJ

I'm trying to run the most basic PixiJS for Haxe sample program, but IntelliJ gives a Type Not Found error.
The failing code:
package ;
import pixi.core.Application;
The error message:
Main.hx:3: characters 7-28 : Type not found : pixi.core.Application
I think the issue is PixiJS-specific, as when I follow the same install-and-import steps for other Haxe modules (eg flambe, flixel) they behave as expected. I've tried with both 4.7.1 and 4.5.5, and as both global and project-specific libraries (separately).
(I hybridized several screenshots to save space)
When running from the console, using:
> haxe -main Main -lib pixijs -js output.js
Everything seems to compile (running the compiled code results in a PIXI is not defined error which is a seperate issue).
UPDATE 1, how I'm adding the dependency:
After executing haxelib install pixijs, I follow these steps:
UDPATE 2, the config being run:
If you can't get it working in the dependencies section you could try adding the haxelibs pixijs externs src/ folder as an additional sources root in Project Structure -> Modules -> (module name) -> Sources. That's how it worked for me:

Yarn force a package to use a specific version

I currently have the the following issue when running a unit test using the Jest Vue cli plugin found here. https://www.npmjs.com/package/#vue/cli-plugin-unit-jest
Error I receive is Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of #babel/core, it is likely that somet
hing in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "#
babel/core" or "babel-core" to see what is calling Babel
I am using Yarn workspaces and would like to know the best way to force #vue/cli-plugin-unit-jest to use babel-core of version ^7.0.0-0

Lots of Flow errors in React Native project

I created a React Native project from Expo. Then I wanted to add Flow to it. I noticed in my node_modules/react-native folder there was a .flowconfig so I copied that to the root of my project. After running flow I got some warnings from files in node_modules/exponent so I added an ignore for that whole folder. Afterwards, I still get many errors when running flow. Here are a few:
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:227
227: /* $FlowFixMe */
^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:1120
1120: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:2162
2162: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
Expo SDK version: 14.0.0
Flow version: 0.37.0
React Native version: 0.41.2
You can suppress errors in .flowconfig file, in [options] section as follows:
[options]
suppress_type=$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-8]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
Then, in [libs] section, you should point so called library definition file, like:
[libs]
./libdefs.js
And in libdefs.js just declare:
declare var __DEV__:string;
These changes should resolve your errors. See:
https://flow.org/en/docs/config/options/#toc-suppress-comment-regex and
https://flow.org/en/docs/libdefs/creation/ for details.
Looks like it might have been an oversight on the flow types for that release version.
All of those errors look fairly harmless though so you could just ignore it. If you absolutely cannot ignore it, update to a later version of React Native that's locked to a different version of Flow? I've had good results personally (no errors) with React Native # 0.42 and Flow # 0.38.
Found this issue which recommended updating the flowconfig to use the latest version from create-react-native-app. Seems to have worked for me.

Intellij external tool does not output stdout logs from Sass

i'm using sass for my project, in intellij using sass plugin.
i want to be able to launch sass --watch from within intellij, to be able to get console feedback, with clickable lines.
i've setup an external tool in intellij with:
Program: D:\ruby\bin\sass.bat
Parameters: --watch $/FileRelativeDir$
Working directory: $ProjectFileDir$
it does compile my scss to css without problems but the stdout from sass are not reported in the intellij console. i only get stderr.
if i have an error, after a while, i get a bunch of lines at once.
so i'm guessing there is some kind of buffering happening.
redirecting 1>&2 does not solve the problem.
Here's what i get in logs
Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is run after stylesheet compilation.
d:/ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.11/vendor/fssm/lib/fssm/support.rb:40: Use RbConfig instead of obsolete and deprecated Config.
and here's what i get using the same command in a console :
Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is
run after stylesheet compilation.
>>> Sass is watching for changes. Press Ctrl-C to stop.
error src/main/www/css/test.scss (Line 3690: Invalid CSS after "...'); IE6 & IE7*": expected "{", was "/")
error src/main/www/css/test.scss (Line 80: Invalid CSS after "...unimplemented *": expected "{", was "/")
d:/ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.11/vendor/fssm/lib/fssm/support.rb:40: Use RbConfig instead of obsolete and deprecated Config.
(yes i have an intended error in my scss file to produce logs)
found it thanks to default ruby arguments in intellij ruby projects
you need to pass ruby the following options :
-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
and that did the trick
Program : D:\ruby\bin\ruby.exe
Parameters : -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) d:/ruby/bin/sass -g --watch $/FileRelativeDir$
Working directory : $ProjectFileDir$