Skip to content

[bug]: Webpack / Typescript build issues #3784

@bennettl

Description

@bennettl

Description

webpack is preventing the app from compiling due to type issues with the algoliasearch package

Language

JavaScript

Client

All

Steps to reproduce

I have the following relevant package dependencies

"typescript": "^4.7.4"
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
 "algoliasearch": "^5.4.1",
"@nestjs/core": "^9.0.0",
...

And executed my backend with nest start --watch and contain the follow errors (on the relvant log output)

Here is my TS Config

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2021",
    "lib": [
      "es2021"
    ],
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "paths": {
      "@app/cache": [
        "libs/cache/src"
      ],
      "@app/cache/*": [
        "libs/cache/src/*"
      ],
      "@app/auth": [
        "libs/auth/src"
      ],
      "@app/auth/*": [
        "libs/auth/src/*"
      ],
      "@app/interceptors": [
        "libs/interceptors/src"
      ],
      "@app/interceptors/*": [
        "libs/interceptors/src/*"
      ],
      "@app/analytics": [
        "libs/analytics/src"
      ],
      "@app/analytics/*": [
        "libs/analytics/src/*"
      ],
      "@app/encrypt": [
        "libs/encrypt/src"
      ],
      "@app/encrypt/*": [
        "libs/encrypt/src/*"
      ],
      "@app/geolocation": [
        "libs/geolocation/src"
      ],
      "@app/geolocation/*": [
        "libs/geolocation/src/*"
      ]
    }
  }
}

Relevant log output

ERROR in /api/node_modules/@algolia/client-common/src/types/cache.ts
55:17-24
[tsl] ERROR in /api/node_modules/@algolia/client-common/src/types/cache.ts(55,18)
      TS2304: Cannot find name 'Storage'.

ERROR in //api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts
4:15-22
[tsl] ERROR in /api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts(4,16)
      TS2304: Cannot find name 'Storage'.

ERROR in /api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts
8:25-32
[tsl] ERROR in. /api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts(8,26)
      TS2304: Cannot find name 'Storage'.

ERROR in/api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts
10:40-46
[tsl] ERROR in /api/node_modules/@algolia/client-common/src/cache/createBrowserLocalStorageCache.ts(10,41)
      TS2304: Cannot find name 'window'.

4 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.76.2 compiled with 4 errors in 16823 ms


### Self-service

- [ ] I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions