Requiring @google-cloud/language breaks webpack ('Module Not Found') -


i'm little baffled @ one, here goes:

i'm trying react application search bar call on google's natural language api (https://cloud.google.com/natural-language/) ,and part of of course installed '@google-cloud/language' package. however, moment try require within of files (my specific case const language = require('@google-cloud/language');) , try run webpack-dev-server, it can't find... think any of modules? it's literally giant wall of "module not found" errors, such as

error in ./~/grpc/~/node-pre-gyp/lib/info.js module not found: 'aws-sdk' in /home/amberb/projects/project-ui/node_modules/grpc/node_modules/node-pre-gyp/lib   @ ./~/grpc/~/node-pre-gyp/lib/info.js 14:14-32  error in ./~/grpc/~/node-pre-gyp/lib/publish.js module not found: 'aws-sdk' in /home/amberb/projects/project-ui/node_modules/grpc/node_modules/node-pre-gyp/lib   @ ./~/grpc/~/node-pre-gyp/lib/publish.js 17:14-32  error in ./~/grpc/~/node-pre-gyp/lib/unpublish.js module not found: 'aws-sdk' in /home/amberb/projects/project-ui/node_modules/grpc/node_modules/node-pre-gyp/lib   @ ./~/grpc/~/node-pre-gyp/lib/unpublish.js 15:14-32  error in /usr/lib/~/npm/bin/npm-cli.js module parse failed: /usr/lib/node_modules/npm/bin/npm-cli.js unexpected character '#' (1:0) may need appropriate loader handle file type. syntaxerror: unexpected character '#' (1:0)  @ /usr/lib/~/npm/lib/npm.js 453:4-32  error in /usr/lib/~/npm/~/opener/opener.js module parse failed: /usr/lib/node_modules/npm/node_modules/opener/opener.js unexpected character '#' (1:0) may need appropriate loader handle file type. syntaxerror: unexpected character '#' (1:0)  @ /usr/lib/~/npm/lib/auth/sso.js 4:13-30  error in /usr/lib/~/npm/~/jsonstream/index.js module parse failed: /usr/lib/node_modules/npm/node_modules/jsonstream/index.js unexpected character '#' (1:0) may need appropriate loader handle file type. syntaxerror: unexpected character '#' (1:0)  @ /usr/lib/~/npm/lib/search/all-package-metadata.js 12:17-38  error in /usr/lib/~/npm/~/npm-registry-client/lib/initialize.js module not found: 'json' in /usr/lib/node_modules/npm/node_modules/npm-registry-client/lib   @ /usr/lib/~/npm/~/npm-registry-client/lib/initialize.js 5:10-36  error in /usr/lib/~/npm/~/validate-npm-package-name/index.js module not found: 'json' in /usr/lib/node_modules/npm/node_modules/validate-npm-package-name   @ /usr/lib/~/npm/~/validate-npm-package-name/index.js 4:15-34  error in /usr/lib/~/npm/~/pacote/lib/util/opt-check.js module not found: 'json' in /usr/lib/node_modules/npm/node_modules/pacote/lib/util 

(this continues time)

this not happen whenever don't include @google-cloud/language. can't seem find explanation might doing this. know @ least try?

edited add: after this question came recommended related question, tried adding

externals: {       '@google-cloud/language': 'commonjs @google-cloud/language'   } 

in webpack config file, results in page not loading , giving me webpack:///external_%22@google-cloud/language%22?:1 uncaught referenceerror: require not defined. i'm new webpack still, i'm positive i'm missing something, i'm not sure what.

if else came here issue this, problem trying include package should not have been included on front-end within front end. split off our back-end api gateway , calling within front end. rule, functionality makes api call have provide authentication , may incur use costs should split off separate back-end service/function.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -