Error message: "Webpack cannot find TypeORM module during build process"

After researching the issue extensively, I came across various discussions on the typeorm github repository. Unfortunately, all of them were closed without a definite solution provided. It appears to be related to a webpack problem, but the exact nature of the issue eludes my understanding. Surprisingly, the example compiles perfectly fine for me.

The error occurs immediately upon calling createConnection, an imported function from typeorm. The error message I encounter is as follows (with parts of the paths excluded for brevity):

WARNING in ./node_modules/typeorm/platform/PlatformTools.js
Module not found: Error: Can't resolve 'redis' in '/my/project/node_modules/typeorm/platform'
@ ./node_modules/typeorm/platform/PlatformTools.js
@ ./node_modules/typeorm/index.js
@ ./src/main.ts

... Other similar warning and error messages follow ...

This error persists in my project setup. Here's a snippet of my package.json file (some dependencies have been removed for clarity):

{
  "name": "something-with-electron",
  "version": "1.0.0",
  ... // Remaining package.json content
}

Additionally, here is my webpack.config.js:

const path = require('path')
const HTMLWebpackPlugin = require('html-webpack-plugin');
... // Remaining webpack config content

If anyone has insights or suggestions regarding this issue, please feel free to share. Any assistance would be greatly appreciated!

Answer №1

While setting up my project, I encountered the same issue.

To fix this problem, you can include the following plugin in your webpack configuration to eliminate warnings for plugins you do not wish to use:

new FilterWarningsPlugin({
    exclude: [/mongodb/, /mssql/, /mysql/, /mysql2/, /oracledb/, /redis/, /sqlite3/, /sql.js/, /react-native-sqlite-storage/]
})

I hope this solution will be useful to you :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

$rootScope:task_in_prog The action is currently underway and cannot be started again

Working with Angular Material has posed challenges for me, particularly in grasping the intricacies of the $scope.apply functionality. Whenever I attempt to notify the UI of changes by invoking apply, it consistently fails with an error. While similar ques ...

I find it strange that this warning message continues to pop up even though there is already a key prop assigned. It keeps saying: "Each child in a list should have a unique 'key'

As a newcomer to React, I find myself puzzled by the recurring appearance of this warning message: Warning: Each child in a list should have a unique "key" prop Even though there is already a key prop present on the element, why does this warn ...

Tips for sending multiple post parameters to a web API in Angular using TypeScript

I am looking to send multiple values to a web API using AngularJS TypeScript. // POST api/values public void Post([FromBody]string value1, [FromBody]string value2) { } I want to make the method call like this: $http.post('api/values', ???) I ...

Exploring the world of Typescript TSX with the power of generic

Introducing JSX syntax support in Typescript opens up new possibilities. I have an expression that functions smoothly with traditional *.ts files, but encounters issues with *.tsx files: const f = <T1>(arg1: T1) => <T2>(arg2: T2) => { ...

Guide on utilizing external namespaces to define types in TypeScript and TSX

In my current project, I am working with scripts from Google and Facebook (as well as other external scripts like Intercom) in TypeScript by loading them through a script tag. However, I have encountered issues with most of them because I do not have acces ...

Issue: React child components cannot be objects (received: object with keys)

Hey everyone, I could really use some help figuring out what I'm doing wrong. Here is the error message I'm receiving: Error: Objects are not valid as a React child (found: object with keys {id, title, bodyText, icon}). If you meant to render a ...

Utilize generated styling data bindings when referencing assets

Currently, I am working with vue-cli 3 and trying to create background-image paths. To achieve this, I am utilizing the style data bind within a v-for-loop. Below is the component structure: <template> <ul> <li v-for="(tool, inde ...

No output being displayed on the browser for the specific element

I am encountering an issue with my filtered collection: this.myForm.get('filterProduct').valueChanges.subscribe( value => { data.Stores.forEach(filtered => { console.log(filtered.Products.filter(val => value.slic ...

Distinguish between a function and a constructor during execution

As I work with TypeScript, I am creating a function that accepts an error factory as an argument. This factory can be either a class name or a function. The function looks something like this: // Alias from class-transformer package type ClassConstructor& ...

Is it necessary for me to include the class in an external interface file that holds functions which receive the class object as a parameter?

In the process of creating an external interface file that includes various functions for the Game class, one particular function requires a Player object as a parameter. The question arises: should the Player file be imported into the interface file? i ...

The new PropTypes package is incompatible with TypeScript's React context functionality

When utilizing React.PropTypes, the code functions correctly but triggers a warning about deprecation (Accessing PropTypes via the main React package is deprecated...): import * as React from 'react'; export class BackButton extends React.Compo ...

Tips for incorporating buttons into columns on ng2-table within Angular 2

I am in need of a table with an edit button in every column using ng2. However, I have encountered an issue placing the buttons at the end of each column. Here is my HTML code: <ng-table [config]="config.sorting" (tableChanged)="onChangeTable(co ...

Issue encountered while declaring a variable as a function in TSX

Being new to TS, I encountered an interesting issue. The first code snippet worked without any errors: interface Props { active: boolean error: any // unknown input: any // unknown onActivate: Function onKeyUp: Function onSelect: Function onU ...

Inferring object types through direct values

This code example has a lot of detail: interface Coordinate { latitude: 40.7128; longitude: -74.0060; } const location: Coordinate = { latitude: 40.7128, longitude: -74.0060, }; // The inferred type would have been // { x: number; y: number; } I ...

In Typescript, what is the antonym of "Choose"?

I'm attempting to create a custom type that can remove specific properties from an object, unlike the Pick utility. The desired functionality is as follows: type ObjectType = { key1: number, key2: string, key3: boolean, key4: num ...

Unveiling individual modules of an Angular library using public-api.ts in the latest version of Angular (Angular 13)

After completing an upgrade on my Angular library project from version 11 to 13, I encountered an issue when attempting to execute the ng build command. In version 11, the setup looked like this: I had multiple smaller modules, each containing various co ...

Change array association with object extension

I am looking to transform the assignment below into one that utilizes object spread: bData.steps[bStepKey].params= cData[cKey] My attempt so far has been unsuccessful. bData= {...bData, steps:{ ...bData.steps[bStepKey], params: cData[cKey]}} ...

Implementing updates for Vue application managed by GO

I recently developed a basic web application using Go with only one web page. To enhance the functionality, I utilized Vue CLI to set up webpack. While the Vue application runs smoothly by npm, I encountered an issue when integrating Vue with the Go web ap ...

The combination of TypeScript 2.6 and material-ui 1.0.0-beta.24's withStyles with react-router withRouter is resulting in the error message: "Property 'classes' is missing in type."

Using the high order components withStyles and withRouter together has been a smooth process so far. However, after upgrading to the latest versions of these components, an error occurred. Learn more about higher-order components List of packages used: ...

Determine the route path during the ongoing navigation event in Angular 8 using NavigationStart

Looking for a way to retrieve the router path during a NavigationStart event in Angular 8 this.router.events .pipe(filter(event => event instanceof NavigationStart)) .subscribe((event: NavigationStart) => { // need help gett ...