Errors building with webpack
See original GitHub issue#1286 and #741 suggest that this module should work with webpack. However, I’m having errors trying to build a simple webpack project.
Environment details
- OS: Ubuntu 20.04.1 LTS
- Node.js version: v14.8.0
- npm version: 6.14.8
googleapis
version: 59.0.0
Steps to reproduce
- Create the files listed below (this is the simplest example I can come up with)
- Run
npm run build
- Observe webpack spitting out errors about how it can’t find lots of modules
package.json:
{
"dependencies": {
"googleapis": "59.0.0"
},
"devDependencies": {
"webpack": "4.44.1",
"webpack-cli": "3.3.12"
},
"scripts": {
"dev": "webpack"
}
}
src/index.js:
import {google} from 'googleapis'
console.log(google)
Errors output by webpack:
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'child_process' in '/workspace/bug/node_modules/google-auth-library/build/src/auth'
@ ./node_modules/google-auth-library/build/src/auth/googleauth.js 17:24-48
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'fs' in '/workspace/bug/node_modules/google-auth-library/build/src/auth'
@ ./node_modules/google-auth-library/build/src/auth/googleauth.js 18:11-24
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
etc etc
Full error output
ERROR in ./node_modules/google-p12-pem/build/src/index.js
Module not found: Error: Can't resolve 'fs' in '/workspace/bug/node_modules/google-p12-pem/build/src'
@ ./node_modules/google-p12-pem/build/src/index.js 10:11-24
@ ./node_modules/gtoken/build/src/index.js
@ ./node_modules/google-auth-library/build/src/auth/jwtclient.js
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/googleapis-common/build/src/discovery.js
Module not found: Error: Can't resolve 'fs' in '/workspace/bug/node_modules/googleapis-common/build/src'
@ ./node_modules/googleapis-common/build/src/discovery.js 16:11-24
@ ./node_modules/googleapis-common/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/gtoken/build/src/index.js
Module not found: Error: Can't resolve 'fs' in '/workspace/bug/node_modules/gtoken/build/src'
@ ./node_modules/gtoken/build/src/index.js 10:11-24
@ ./node_modules/google-auth-library/build/src/auth/jwtclient.js
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/googleapis-common/build/src/http2.js
Module not found: Error: Can't resolve 'http2' in '/workspace/bug/node_modules/googleapis-common/build/src'
@ ./node_modules/googleapis-common/build/src/http2.js 16:14-30
@ ./node_modules/googleapis-common/build/src/apirequest.js
@ ./node_modules/googleapis-common/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/https-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'net' in '/workspace/bug/node_modules/https-proxy-agent/dist'
@ ./node_modules/https-proxy-agent/dist/agent.js 15:30-44
@ ./node_modules/https-proxy-agent/dist/index.js
@ ./node_modules/gaxios/build/src/gaxios.js
@ ./node_modules/gaxios/build/src/index.js
@ ./node_modules/google-auth-library/build/src/transporters.js
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
ERROR in ./node_modules/https-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'tls' in '/workspace/bug/node_modules/https-proxy-agent/dist'
@ ./node_modules/https-proxy-agent/dist/agent.js 16:30-44
@ ./node_modules/https-proxy-agent/dist/index.js
@ ./node_modules/gaxios/build/src/gaxios.js
@ ./node_modules/gaxios/build/src/index.js
@ ./node_modules/google-auth-library/build/src/transporters.js
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./src/index.js
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >Webpack build error - node.js - Stack Overflow
You can use the npm ls --depth=0 to list the installed packages for a project. Run it on PC_A and PC_B, then compare...
Read more >This will make you more efficient at debugging Webpack ...
In this article we'll build a very primitive plugin for Webpack and then I'll show you how to find out if this plugin...
Read more >next build fails with webpack error #25276 - GitHub
When attempting to do a build with next build I get the following error. With next 10.2.0, the error does not appear. info...
Read more >Make Webpack exit on compilation errors - Medium
Upon seeing an error, Webpack causes the pipeline process to hang, and developers are left wondering why the build hasn't finished in over ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fhinkel the issue is resolved when bundling for node, but not when bundling for the browser. I’ll leave it to the project maintainers whether they’d rather have bug reports in an ‘open’ or ‘closed’ state, but afaics the issue still exists.
I’m still seeing this issue with Create React App