Categories
Mastering Development

Unable to load preload script – Electron.js Ubuntu 18.04.4

I’m trying to understand how to effectively load the proload.js file in electron: Version "electron": "^9.1.2", Version "electron-builder": "^22.8.0", In background.js I put webPreferences: { nodeIntegration: false, contextIsolation: true, //preload: path.join(app.getAppPath(), "preload.js"), preload: path.join(__dirname, "./preload.js"), }, preload.js and background.js are in the same folder: src folder. this is my preload.js : const { contextBridge, ipcRenderer […]

Categories
Mastering Development

You may need an appropriate loader to handle this file type, currently no loaders are configured to process file

I just created a project using create-react-app (in javascript). In that, I am linking one of my other repository like this { "name": "hh-frontend-example", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "hh-stylesheet": "file:../hh-stylesheet", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.1" }, Here notice this line: "hh-stylesheet": "file:../hh-stylesheet", Now, When I start […]

Categories
Mastering Development

TypeScript not finding variable declared in type declaration if I import a file

I made a very simple library which contains a .d.ts (source) which has the following structure (I omit the details because the file works fine, it likely is a config issue in my project): // Some helper types and interfaces type TranslationFunction = /* … */; export { TranslationFunction }; Then, I do npm i […]

Categories
Development

Typescript cannot find module defined in paths

I have a typescript application that has paths for absolute imports. My tsconfig looks like this: { “compilerOptions”: { “baseUrl”: “.”, “paths”: { “utils*”: [“src/utils*”], “operations*”: [“src/operations*”], “actions*”: [“src/actions*”], “components*”: [“src/components*”], “constants*”: [“src/constants*”], }, “outDir”: “dist”, “module”: “esnext”, “target”: “esnext”, “moduleResolution”: “node”, “noEmit”: true, “lib”: [“es2017”, “dom”], “noUnusedLocals”: true, “sourceMap”: true, “skipLibCheck”: true, “allowJs”: true, […]

Categories
Development

Jest & React & Typescript & React-Testing-Library error

I have a React/NextJS project setup using Typescript and am adding unit testing with Jest and React Testing Library. A unit test for my component looks like this: import React from ‘react’; import ‘@testing-library/jest-dom/extend-expect’; import { render } from ‘@testing-library/react’; import AppLayout from ‘.’; describe(‘<AppLayout>’, () => { it(‘renders children’, () => { const children […]

Categories
Development Vue

How to configure Jest added to an app via Vue cli 3?

I’m trying to introduce testing with Jest into an app build with Vue. I’ve run vue add unit-jest and similarly to what testing single file components with Jest guide suggests, created the following simple test file (Paginator.spec.js in the same folder as Paginator.vue, that is /src/components): import { mount } from ‘@vue/test-utils’ import Paginator from […]

Categories
Development

How to correctly type the apply method for browser console logging functions?

I’ve written the below class to capture the console.log function in my app so I can review the logs on devices where I can’t easily access the browser console and so later I can bundle the captured logs when reporting errors. In order to get it working, I’ve had to add ts-ignore like this: // […]