firebase / firebase-functions

Firebase SDK for Cloud Functions
https://firebase.google.com/docs/functions/
MIT License
1.02k stars 201 forks source link

ERROR in ./node_modules/google-gax/build/src/operationsClient.js #540

Closed manel00 closed 5 years ago

manel00 commented 5 years ago

Related issues

[REQUIRED] Version info

node:

firebase-functions:

activateNotifications() { const functions = require('firebase-functions')

exports.useWildcard = functions.firestore
  .document('objects/{wildcard}')
  .onCreate((snap, context) => {
    const data = snap.data();
    const name = data.name
    const title = data.title
    const message = `${name} uploaded ${title}, this one looks interesting :P`
    this.notifications.schedule({
      badge: 1,
      title: 'New Object!!!',
      text: message,
      foreground: true,
    });
  });

}

firebase-tools:

firebase-admin:

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

[REQUIRED] Expected behavior

Dont crash, just want to make appear a local notification once someone adds a new document on a collection on Firestore (Ionic 4)

[REQUIRED] Actual behavior

[ng] WARNING in ./node_modules/firebase-functions/lib/config.js 52:23-36 [ng] Critical dependency: the request of a dependency is an expression [ng] WARNING in ./node_modules/firebase-functions/lib/config.js 75:23-36 [ng] Critical dependency: the request of a dependency is an expression [ng] WARNING in ./node_modules/hash-stream-validation/index.js [ng] Module not found: Error: Can't resolve 'fast-crc32c' in '/home/manel/Objects/node_modules/hash-stream-validation' [ng] WARNING in ./node_modules/write-file-atomic/index.js [ng] Module not found: Error: Can't resolve 'worker_threads' in '/home/manel/Objects/node_modules/write-file-atomic' [ng] [ng] ERROR in ./node_modules/google-gax/build/src/operationsClient.js [ng] Module not found: Error: Can't resolve './operations_client_config' in '/home/manel/Objects/node_modules/google-gax/build/src' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'child_process' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'child_process' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'child_process' in '/home/manel/Objects/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/graceful-fs/polyfills.js [ng] Module not found: Error: Can't resolve 'constants' in '/home/manel/Objects/node_modules/graceful-fs' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/crypto/node/crypto.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/crypto/node' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/file.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/aws-sign2/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/aws-sign2' [ng] ERROR in ./node_modules/aws4/aws4.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/aws4' [ng] ERROR in ./node_modules/crypto-random-string/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/crypto-random-string' [ng] ERROR in ./node_modules/ecc-jsbn/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/ecc-jsbn' [ng] ERROR in ./node_modules/firebase-admin/lib/auth/token-generator.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/firebase-admin/lib/auth' [ng] ERROR in ./node_modules/gcs-resumable-upload/build/src/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/gcs-resumable-upload/build/src' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/crypto/node/crypto.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/crypto/node' [ng] ERROR in ./node_modules/google-auth-library/build/src/crypto/node/crypto.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/google-auth-library/build/src/crypto/node' [ng] ERROR in ./node_modules/hash-stream-validation/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/hash-stream-validation' [ng] ERROR in ./node_modules/http-signature/lib/signer.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/http-signature/lib' [ng] ERROR in ./node_modules/http-signature/lib/verify.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/http-signature/lib' [ng] ERROR in ./node_modules/jwa/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/jwa' [ng] ERROR in ./node_modules/oauth-sign/index.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/oauth-sign' [ng] ERROR in ./node_modules/request/lib/helpers.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/request/lib' [ng] ERROR in ./node_modules/request/lib/hawk.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/request/lib' [ng] ERROR in ./node_modules/request/lib/oauth.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/request/lib' [ng] ERROR in ./node_modules/sshpk/lib/identity.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/key.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/utils.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/signature.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/fingerprint.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/private-key.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/dhe.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/certificate.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib/formats' [ng] ERROR in ./node_modules/sshpk/lib/formats/pem.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib/formats' [ng] ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js [ng] Module not found: Error: Can't resolve 'crypto' in '/home/manel/Objects/node_modules/sshpk/lib/formats' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-p12-pem/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-p12-pem/build/src' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/gtoken/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/gtoken/build/src' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/bucket.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/file.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/@grpc/proto-loader/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/@grpc/proto-loader/build/src' [ng] ERROR in ./node_modules/firebase-admin/lib/firebase-namespace.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/firebase-admin/lib' [ng] ERROR in ./node_modules/firebase-admin/lib/auth/credential.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/firebase-admin/lib/auth' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-p12-pem/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-p12-pem/build/src' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/gtoken/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/gtoken/build/src' [ng] ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-gax/build/src/grpc.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/google-gax/build/src' [ng] ERROR in ./node_modules/google-p12-pem/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/google-p12-pem/build/src' [ng] ERROR in ./node_modules/graceful-fs/graceful-fs.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/graceful-fs' [ng] ERROR in ./node_modules/gtoken/build/src/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/gtoken/build/src' [ng] ERROR in ./node_modules/make-dir/index.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/make-dir' [ng] ERROR in ./node_modules/request/lib/har.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/request/lib' [ng] ERROR in ./node_modules/walkdir/walkdir.js [ng] Module not found: Error: Can't resolve 'fs' in '/home/manel/Objects/node_modules/walkdir' [ng] ERROR in ./node_modules/firebase-admin/lib/utils/api-request.js [ng] Module not found: Error: Can't resolve 'http' in '/home/manel/Objects/node_modules/firebase-admin/lib/utils' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'http' in '/home/manel/Objects/node_modules/forever-agent' [ng] ERROR in ./node_modules/http-signature/lib/signer.js [ng] Module not found: Error: Can't resolve 'http' in '/home/manel/Objects/node_modules/http-signature/lib' [ng] ERROR in ./node_modules/request/request.js [ng] Module not found: Error: Can't resolve 'http' in '/home/manel/Objects/node_modules/request' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'http' in '/home/manel/Objects/node_modules/tunnel-agent' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'http2' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js [ng] Module not found: Error: Can't resolve 'http2' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'http2' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'http2' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js [ng] Module not found: Error: Can't resolve 'http2' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/agent-base/patch-core.js [ng] Module not found: Error: Can't resolve 'https' in '/home/manel/Objects/node_modules/agent-base' [ng] ERROR in ./node_modules/firebase-admin/lib/utils/api-request.js [ng] Module not found: Error: Can't resolve 'https' in '/home/manel/Objects/node_modules/firebase-admin/lib/utils' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'https' in '/home/manel/Objects/node_modules/forever-agent' [ng] ERROR in ./node_modules/request/request.js [ng] Module not found: Error: Can't resolve 'https' in '/home/manel/Objects/node_modules/request' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'https' in '/home/manel/Objects/node_modules/tunnel-agent' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in '/home/manel/Objects/node_modules/forever-agent' [ng] ERROR in ./node_modules/https-proxy-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in '/home/manel/Objects/node_modules/https-proxy-agent' [ng] ERROR in ./node_modules/tough-cookie/lib/cookie.js [ng] Module not found: Error: Can't resolve 'net' in '/home/manel/Objects/node_modules/tough-cookie/lib' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in '/home/manel/Objects/node_modules/tunnel-agent' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/file.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/configstore/index.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/configstore' [ng] ERROR in ./node_modules/firebase-admin/lib/auth/credential.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/firebase-admin/lib/auth' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/xdg-basedir/index.js [ng] Module not found: Error: Can't resolve 'os' in '/home/manel/Objects/node_modules/xdg-basedir' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@google-cloud/firestore/build/src/v1' [ng] ERROR in ./node_modules/@google-cloud/firestore/build/src/v1/firestore_admin_client.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@google-cloud/firestore/build/src/v1' [ng] ERROR in ./node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@google-cloud/firestore/build/src/v1beta1' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/bucket.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/@grpc/proto-loader/build/src/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/@grpc/proto-loader/build/src' [ng] ERROR in ./node_modules/configstore/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/configstore' [ng] ERROR in ./node_modules/firebase-admin/lib/auth/credential.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/firebase-admin/lib/auth' [ng] ERROR in ./node_modules/firebase-functions/lib/providers/firestore.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/firebase-functions/lib/providers' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-gax/build/src/grpc.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/google-gax/build/src' [ng] ERROR in ./node_modules/google-gax/build/src/operationsClient.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/google-gax/build/src' [ng] ERROR in ./node_modules/make-dir/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/make-dir' [ng] 31mERROR in ./node_modules/mime-types/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/mime-types' [ng] ERROR in ./node_modules/walkdir/walkdir.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/walkdir' [ng] ERROR in ./node_modules/write-file-atomic/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/write-file-atomic' [ng] ERROR in ./node_modules/xdg-basedir/index.js [ng] Module not found: Error: Can't resolve 'path' in '/home/manel/Objects/node_modules/xdg-basedir' [ng] ERROR in ./node_modules/@google-cloud/common/build/src/util.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@google-cloud/common/build/src' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/gaxios/build/src/gaxios.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/gaxios/build/src' [ng] ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/oauth2client.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/@google-cloud/paginator/build/src/index.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@google-cloud/paginator/build/src' [ng] ERROR in ./node_modules/@google-cloud/projectify/build/src/index.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@google-cloud/projectify/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/assert-plus/assert.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/assert-plus' [ng] ERROR in ./node_modules/bun/node_modules/readable-stream/readable.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/bun/node_modules/readable-stream' [ng] ERROR in ./node_modules/bun/node_modules/readable-stream/lib/_stream_readable.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/bun/node_modules/readable-stream/lib' [ng] ERROR in ./node_modules/bun/node_modules/readable-stream/lib/_stream_writable.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/bun/node_modules/readable-stream/lib' [ng] ERROR in ./node_modules/combined-stream/lib/combined_stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/combined-stream/lib' [ng] ERROR in ./node_modules/delayed-stream/lib/delayed_stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/delayed-stream/lib' [ng] ERROR in ./node_modules/dicer/lib/Dicer.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/dicer/lib' [ng] ERROR in ./node_modules/dicer/lib/PartStream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/dicer/lib' [ng] ERROR in ./node_modules/gaxios/build/src/gaxios.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/gaxios/build/src' [ng] ERROR in ./node_modules/gcs-resumable-upload/build/src/index.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/gcs-resumable-upload/build/src' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/gaxios/build/src/gaxios.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/gaxios/build/src' [ng] ERROR in ./node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth/oauth2client.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/gcs-resumable-upload/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-auth-library/build/src/auth/oauth2client.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/google-auth-library/build/src/auth' [ng] ERROR in ./node_modules/google-gax/build/src/paginationCalls/pageDescriptor.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/google-gax/build/src/paginationCalls' [ng] ERROR in ./node_modules/graceful-fs/legacy-streams.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/graceful-fs' [ng] ERROR in ./node_modules/isstream/isstream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/isstream' [ng] ERROR in ./node_modules/jws/lib/verify-stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/jws/lib' [ng] ERROR in ./node_modules/jws/lib/sign-stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/jws/lib' [ng] ERROR in ./node_modules/jws/lib/data-stream.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/jws/lib' [ng] ERROR in ./node_modules/request/request.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/request' [ng] ERROR in ./node_modules/sshpk/lib/ed-compat.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/sshpk/lib' [ng] ERROR in ./node_modules/teeny-request/build/src/index.js [ng] Module not found: Error: Can't resolve 'stream' in '/home/manel/Objects/node_modules/teeny-request/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'tls' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js [ng] Module not found: Error: Can't resolve 'tls' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in '/home/manel/Objects/node_modules/forever-agent' [ng] ERROR in ./node_modules/https-proxy-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in '/home/manel/Objects/node_modules/https-proxy-agent' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in '/home/manel/Objects/node_modules/tunnel-agent' [ng] ERROR in ./node_modules/@google-cloud/storage/build/src/file.js [ng] Module not found: Error: Can't resolve 'zlib' in '/home/manel/Objects/node_modules/@google-cloud/storage/build/src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/compression-filter.js [ng] Module not found: Error: Can't resolve 'zlib' in '/home/manel/Objects/node_modules/@grpc/grpc-js/build/src' [ng] ERROR in ./node_modules/firebase-admin/lib/utils/api-request.js [ng] Module not found: Error: Can't resolve 'zlib' in '/home/manel/Objects/node_modules/firebase-admin/lib/utils'[39m [ng] ERROR in ./node_modules/request/request.js [ng] Module not found: Error: Can't resolve 'zlib' in '/home/manel/Objects/node_modules/request'

Were you able to successfully deploy your functions?

kevinajian commented 5 years ago

@manel00 Can you provide more info on your setup (fill out the version info) and give us steps to reproduce? Also can you try installing the missing modules that you're getting errors for?

google-oss-bot commented 5 years ago

Hey @manel00. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 5 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@manel00 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

NathanaelZondo commented 4 years ago

[ng] ERROR in ./node_modules/google-gax/build/src/operationsClientBrowser.js [ng] Module not found: Error: Can't resolve './operations_client_config' in 'G:\pro\node_modules\google-gax\build\src' [ng] ERROR in ./node_modules/request/lib/har.js [ng] Module not found: Error: Can't resolve 'fs' in 'G:\pro\node_modules\request\lib' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tough-cookie/lib/cookie.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tough-cookie\lib' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in Source file not found: 'G:/pro/src/app/viewhairstyle/viewhairstyle.page.ts'. [ng] i 「wdm」: Failed to compile. [ng] i 「wdm」: Compiling... [ng] Date: 2019-08-22T14:12:28.314Z - Hash: 8d056d70262645159513 [ng] 112 unchanged chunks [ng] chunk {viewhairstyle-viewhairstyle-module} viewhairstyle-viewhairstyle-module.js, viewhairstyle-viewhairstyle-module.js.map (viewhairstyle-viewhairstyle-module) 6.69 kB [rendered] [ng] Time: 964ms [ng] [ng] ERROR in ./node_modules/google-gax/build/src/operationsClientBrowser.js [ng] Module not found: Error: Can't resolve './operations_client_config' in 'G:\pro\node_modules\google-gax\build\src' [ng] ERROR in ./node_modules/request/lib/har.js [ng] Module not found: Error: Can't resolve 'fs' in 'G:\pro\node_modules\request\lib' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tough-cookie/lib/cookie.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tough-cookie\lib' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\tunnel-agent' [ng] i 「wdm」: Failed to compile. [ng] [ng] ERROR in src/app/viewhairstyle/viewhairstyle.page.ts(21,4): error TS2322: Type 'unknown' is not assignable to type '{}'. [ng] [ng] [ng] ERROR in src/app/viewhairstyle/viewhairstyle.page.ts(21,4): error TS2322: Type 'unknown' is not assignable to type '{}'. [ng] [ng] i 「wdm」: Compiling... [ng] Date: 2019-08-22T14:12:34.822Z - Hash: e505f0a0cfdaafad15d6 [ng] 112 unchanged chunks [ng] chunk {viewhairstyle-viewhairstyle-module} viewhairstyle-viewhairstyle-module.js, viewhairstyle-viewhairstyle-module.js.map (viewhairstyle-viewhairstyle-module) 6.7 kB [rendered] [ng] Time: 858ms [ng] [ng] ERROR in ./node_modules/google-gax/build/src/operationsClientBrowser.js [ng] Module not found: Error: Can't resolve './operations_client_config' in 'G:\pro\node_modules\google-gax\build\src' [ng] ERROR in ./node_modules/request/lib/har.js [ng] Module not found: Error: Can't resolve 'fs' in 'G:\pro\node_modules\request\lib' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tough-cookie/lib/cookie.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tough-cookie\lib' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\tunnel-agent' [ng] i 「wdm」: Failed to compile. [ng] i 「wdm」: Compiling... [ng] Date: 2019-08-22T14:14:17.065Z - Hash: 87fe1f8f78ae5d0c2b29 [ng] 113 unchanged chunks [ng] Time: 956ms [ng] [ng] ERROR in ./node_modules/google-gax/build/src/operationsClientBrowser.js [ng] Module not found: Error: Can't resolve './operations_client_config' in 'G:\pro\node_modules\google-gax\build\src' [ng] ERROR in ./node_modules/request/lib/har.js [ng] Module not found: Error: Can't resolve 'fs' in 'G:\pro\node_modules\request\lib' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js [ng] Module not found: Error: Can't resolve 'http2' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tough-cookie/lib/cookie.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tough-cookie\lib' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'net' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\@grpc\grpc-js\build\src' [ng] ERROR in ./node_modules/forever-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\forever-agent' [ng] ERROR in ./node_modules/tunnel-agent/index.js [ng] Module not found: Error: Can't resolve 'tls' in 'G:\pro\node_modules\tunnel-agent' [ng] ERROR in Source file not found: 'G:/pro/src/app/backend.service.ts'.

NathanaelZondo commented 4 years ago

I had thesame error import { Injectable } from '@angular/core'; import { Component, OnInit } from '@angular/core'; import { NavController, NavParams, AlertController, ToastController, LoadingController } from '@ionic/angular'; import * as firebase from 'firebase'; import { FirebaseAuth, FirebaseDatabase } from '@angular/fire'; import { Router } from '@angular/router'; import { AngularFireDatabase } from '@angular/fire/database'; import {AngularFirestore,AngularFirestoreCollection,AngularFirestoreDocument} from '@angular/fire/firestore'; import { Profile } from './profile'; import { Observable } from 'rxjs/Observable'; import { ControlsService } from './controls.service'; import { bookings } from './booking'; import { Firestore } from '@google-cloud/firestore';

@Injectable({ providedIn: 'root' }) export class BackendService { itemsCollection:AngularFirestoreCollection; items:Observable<any[]>;

saloncollection:AngularFirestoreCollection; salons:Observable<any[]>; menstyles:Observable; womenstyles:Observable; displayProfile: FirebaseFirestore.DocumentData; constructor(public afs:AngularFirestore,public control:ControlsService,public db:Firestore,public loadingController: LoadingController)

I just removed "db:Firestore". I dont know what caused it though or maybe the "afs" declaration is causing the conflict. .

matheo commented 4 years ago

Suddenly I got this error too

WARNING in node_modules/firebase-functions/lib/config.js 52:23-36
Critical dependency: the request of a dependency is an expression

WARNING in node_modules/firebase-functions/lib/config.js 75:23-36
Critical dependency: the request of a dependency is an expression

WARNING in node_modules/hash-stream-validation/index.js
Module not found: Error: Can't resolve 'fast-crc32c' in 'node_modules/hash-stream-validation'

WARNING in node_modules/gcs-resumable-upload/node_modules/write-file-atomic/index.js
Module not found: Error: Can't resolve 'worker_threads' in 'node_modules/gcs-resumable-upload/node_modules/write-file-atomic'

ERROR in /media/work/git/sudshare/monorepo/node_modules/google-gax/build/src/operationsClient.js
Module not found: Error: Can't resolve './operations_client_config' in 'node_modules/google-gax/build/src'

Oh, now I realize I mixed "backend" code with frontend's...

AbeerNS commented 4 years ago

THIS FIXED IT FOR ME:

I opened google-gax\build\src\operationsClient.js file and changed const configData = require('./operations_client_config'); to const configData = require('./operations_client_config.json');

which solved the error ERROR in ./node_modules/google-gax/build/src/operationsClient.js Module not found: Error: Can't resolve './operations_client_config' in 'C:\..\Projects\qaymni\node_modules\google-gax\build\src' resolve './operations_client_config' ......

I hope it helps someone

jketcham commented 4 years ago

If you're bundling with webpack, you should use something like webpack-node-externals to exclude /node_modules/ from being bundled.

Master-Goldeau commented 4 years ago

Hi everybody,

I have the same problem because of firebase-admin sdk. I did what @AbeerNS recommanded but it seems not enough for me.

@jketcham could you please provide more details ? I don't understand where to copy : ... module.exports = { ... target: 'node', // in order to ignore built-in modules like path, fs, etc. externals: [nodeExternals()], // in order to ignore all modules in node_modules folder ... }; Also I don't have webpack.config.js in my project, but webpack-browser-config.js ... ???

jketcham commented 4 years ago

@Master-Goldeau you'd want to put that in your webpack config, so in your case that sounds like webpack-browser-config.js. (Webpack will look for a file called webpack.config.js by default, so if you only have one config, you might want to change it to that).

The config would look something like:

const nodeExternals = require('webpack-node-externals');

module.exports = {
  target: 'node',

  ... entry, output, modules, etc ... 

  externals: [
    nodeExternals(),
  ],
};
Master-Goldeau commented 4 years ago

Thanks for you rapid reply but I don't get it. (javascript beginner sorry...)

here is my webpack-browser-config.js :

const node_1 = require("@angular-devkit/core/node");
const path = require("path");
const webpack_configs_1 = require("../angular-cli-files/models/webpack-configs");
const read_tsconfig_1 = require("../angular-cli-files/utilities/read-tsconfig");
const utils_1 = require("../utils");
const build_browser_features_1 = require("./build-browser-features");
const i18n_options_1 = require("./i18n-options");
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const webpackMerge = require('webpack-merge');
const nodeExternals = require('webpack-node-externals');

async function generateWebpackConfig(context, workspaceRoot, projectRoot, sourceRoot, options, webpackPartialGenerator, logger) {
    // Ensure Build Optimizer is only used with AOT.
    if (options.buildOptimizer && !options.aot) {
        throw new Error(`The 'buildOptimizer' option cannot be used without 'aot'.`);
    }
    // Ensure Rollup Concatenation is only used with compatible options.
    if (options.experimentalRollupPass) {
        if (!options.aot) {
            throw new Error(`The 'experimentalRollupPass' option cannot be used without 'aot'.`);
        }
        if (options.vendorChunk || options.commonChunk || options.namedChunks) {
            throw new Error(`The 'experimentalRollupPass' option cannot be used with the`
                + `'vendorChunk', 'commonChunk', 'namedChunks' options set to true.`);
        }
    }
    const tsConfigPath = path.resolve(workspaceRoot, options.tsConfig);
    const tsConfig = read_tsconfig_1.readTsconfig(tsConfigPath);
    // tslint:disable-next-line:no-implicit-dependencies
    const ts = await Promise.resolve().then(() => require('typescript'));
    // At the moment, only the browser builder supports differential loading
    // However this config generation is used by multiple builders such as dev-server
    const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
    const buildBrowserFeatures = new build_browser_features_1.BuildBrowserFeatures(projectRoot, scriptTarget);
    const differentialLoading = context.builder.builderName === 'browser' &&
        !options.watch &&
        buildBrowserFeatures.isDifferentialLoadingNeeded();
    let buildOptions = { ...options };
    if (differentialLoading) {
        buildOptions = {
            ...options,
            // Under downlevel differential loading we copy the assets outside of webpack.
            assets: [],
            esVersionInFileName: true,
            es5BrowserSupport: undefined,
        };
    }
    const supportES2015 = scriptTarget !== ts.ScriptTarget.JSON && scriptTarget > ts.ScriptTarget.ES5;
    const wco = {
        root: workspaceRoot,
        logger: logger.createChild('webpackConfigOptions'),
        projectRoot,
        sourceRoot,
        buildOptions,
        tsConfig,
        tsConfigPath,
        supportES2015,
        differentialLoadingMode: differentialLoading,
    };
    wco.buildOptions.progress = utils_1.defaultProgress(wco.buildOptions.progress);
    const partials = webpackPartialGenerator(wco);
    const webpackConfig = webpackMerge(partials);
    if (supportES2015) {
        if (!webpackConfig.resolve) {
            webpackConfig.resolve = {};
        }
        if (!webpackConfig.resolve.alias) {
            webpackConfig.resolve.alias = {};
        }
        webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
    }
    if (options.profile || process.env['NG_BUILD_PROFILING']) {
        const esVersionInFileName = webpack_configs_1.getEsVersionForFileName(tsConfig.options.target, wco.buildOptions.esVersionInFileName);
        const smp = new SpeedMeasurePlugin({
            outputFormat: 'json',
            outputTarget: path.resolve(workspaceRoot, `speed-measure-plugin${esVersionInFileName}.json`),
        });
        return smp.wrap(webpackConfig);
    }
    return webpackConfig;
}
exports.generateWebpackConfig = generateWebpackConfig;
async function generateI18nBrowserWebpackConfigFromContext(options, context, webpackPartialGenerator, host = new node_1.NodeJsSyncHost()) {
    const { buildOptions, i18n } = await i18n_options_1.configureI18nBuild(context, options);
    const result = await generateBrowserWebpackConfigFromContext(buildOptions, context, webpackPartialGenerator, host);
    const config = result.config;
    if (i18n.shouldInline) {
        // Remove localize "polyfill" if in AOT mode
        if (buildOptions.aot) {
            if (!config.resolve) {
                config.resolve = {};
            }
            if (!config.resolve.alias) {
                config.resolve.alias = {};
            }
            config.resolve.alias['@angular/localize/init'] = require.resolve('./empty.js');
        }
        // Update file hashes to include translation file content
        const i18nHash = Object.values(i18n.locales).reduce((data, locale) => data + (locale.integrity || ''), '');
        if (!config.plugins) {
            config.plugins = [];
        }
        config.plugins.push({
            apply(compiler) {
                compiler.hooks.compilation.tap('build-angular', compilation => {
                    // Webpack typings do not contain template hashForChunk hook
                    // tslint:disable-next-line: no-any
                    compilation.mainTemplate.hooks.hashForChunk.tap('build-angular', (hash) => {
                        hash.update('$localize' + i18nHash);
                    });
                    // Webpack typings do not contain hooks property
                    // tslint:disable-next-line: no-any
                    compilation.chunkTemplate.hooks.hashForChunk.tap('build-angular', (hash) => {
                        hash.update('$localize' + i18nHash);
                    });
                });
            },
        });
    }
    return { ...result, i18n };
}
exports.generateI18nBrowserWebpackConfigFromContext = generateI18nBrowserWebpackConfigFromContext;
async function generateBrowserWebpackConfigFromContext(options, context, webpackPartialGenerator, host = new node_1.NodeJsSyncHost()) {
    const projectName = context.target && context.target.project;
    if (!projectName) {
        throw new Error('The builder requires a target.');
    }
    const workspaceRoot = core_1.normalize(context.workspaceRoot);
    const projectMetadata = await context.getProjectMetadata(projectName);
    const projectRoot = core_1.resolve(workspaceRoot, core_1.normalize(projectMetadata.root || ''));
    const projectSourceRoot = projectMetadata.sourceRoot;
    const sourceRoot = projectSourceRoot
        ? core_1.resolve(workspaceRoot, core_1.normalize(projectSourceRoot))
        : undefined;
    const normalizedOptions = utils_1.normalizeBrowserSchema(host, workspaceRoot, projectRoot, sourceRoot, options);
    const config = await generateWebpackConfig(context, core_1.getSystemPath(workspaceRoot), core_1.getSystemPath(projectRoot), sourceRoot && core_1.getSystemPath(sourceRoot), normalizedOptions, webpackPartialGenerator, context.logger);
    return {
        config,
        projectRoot: core_1.getSystemPath(projectRoot),
        projectSourceRoot: sourceRoot && core_1.getSystemPath(sourceRoot),
    };
}
exports.generateBrowserWebpackConfigFromContext = generateBrowserWebpackConfigFromContext;
function getIndexOutputFile(options) {
    if (typeof options.index === 'string') {
        return path.basename(options.index);
    }
    else {
        return options.index.output || 'index.html';
    }
}
exports.getIndexOutputFile = getIndexOutputFile;
function getIndexInputFile(options) {
    if (typeof options.index === 'string') {
        return options.index;
    }
    else {
        return options.index.input;
    }
}
exports.getIndexInputFile = getIndexInputFile;
Master-Goldeau commented 4 years ago

so module refers to nothing... Does it ?

its-dibo commented 4 years ago

I got an error in the same file https://github.com/googleapis/gax-nodejs/issues/845