linagora / esn-frontend-inbox

Webmail SPA for the OpenPaaS Suite - https://open-paas.org
Other
12 stars 19 forks source link

Cannot build on production and on Jenkins #533

Open alagane opened 2 years ago

alagane commented 2 years ago

When building for production, or with Jenkins, there is an error. It might be linked to https://github.com/linagora/jmap-client-ts The jmap-client-ts directory inside node_modules does not contain the lib directory on production.

I was not able to reproduce the error locally, using the same npm 6.14.6 and node 12.18.3. Locally the jmaps-client-ts directory contains the lib directory.

ERROR in ./src/esn.inbox.libs/app/services/jmap-client-provider/jmap-client-provider.js
Module not found: Error: Can't resolve 'jmap-client-ts/lib' in '/app/src/esn.inbox.libs/app/services/jmap-client-provider'
 @ ./src/esn.inbox.libs/app/services/jmap-client-provider/jmap-client-provider.js 17:15-44
 @ ./src/esn.inbox.libs/app/app.module.js
 @ ./src/app/app.js
 @ ./src/index.js

ERROR in ./src/esn.inbox.libs/app/services/jmap-client-provider/jmap-client-provider.js
Module not found: Error: Can't resolve 'jmap-client-ts/lib/utils/fetch-transport' in '/app/src/esn.inbox.libs/app/services/jmap-client-provider'
 @ ./src/esn.inbox.libs/app/services/jmap-client-provider/jmap-client-provider.js 20:16-67
 @ ./src/esn.inbox.libs/app/app.module.js
 @ ./src/app/app.js
 @ ./src/index.js
alagane commented 2 years ago

Possible fix: Remove the file restriction on package.json on jmap-client-ts (instead on using only lib) Using a postinstall script on jmap-client-ts to build the project Adding typescript dependency to esn-frontend-inbox to be able to build jmap-client-ts with the correct version

alagane commented 2 years ago

See https://github.com/npm/cli/issues/2062

alagane commented 2 years ago

The problems is the prepare script of jmap-client-ts is not run, this is clearly a npm bug Tried with npm 7.24.2 with different node versions :