Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack Error: "Cannot read property 'tap' of undefined" #3

Open
johndanek opened this issue Mar 19, 2021 · 1 comment
Open

Webpack Error: "Cannot read property 'tap' of undefined" #3

johndanek opened this issue Mar 19, 2021 · 1 comment

Comments

@johndanek
Copy link

johndanek commented Mar 19, 2021

Hello! I'm trying to use serverless-bundle for typescript in my project. I cloned the typescript starter project. This project is part of a workspace, and it extends a base tsconfig.

I can run tsc just fine, but when I try to invoke a serverless function or start the server, I get a cryptic error that I've been trying to fix for hours now:

sls invoke local --function hello

serverless-bundle: CommonJS, ES3, or ES5 are not supported
Serverless: Bundling with Webpack...

ERROR in /Users/{user}/work/next/packages/cloud/lincoln/new-new-api/src/handler.ts
Module build failed (from /Users/{user}/work/next/node_modules/ts-loader/index.js):
TypeError: Cannot read property 'tap' of undefined
    at makeAssetsCallback (/Users/{user}/work/next/node_modules/ts-loader/dist/instances.js:218:50)
    at addAssetHooks (/Users/{user}/work/next/node_modules/ts-loader/dist/instances.js:224:9)
    at Object.initializeInstance (/Users/{user}/work/next/node_modules/ts-loader/dist/instances.js:266:13)
    at successLoader (/Users/{user}/work/next/node_modules/ts-loader/dist/index.js:26:17)
    at Object.loader (/Users/{user}/work/next/node_modules/ts-loader/dist/index.js:23:5)

 Error ---------------------------------------------------

  Error: Webpack compilation error, see stats above
      at /Users/{user}/work/next/node_modules/serverless-bundle/node_modules/serverless-webpack/lib/compile.js:32:15

I can find no leads in debugging as to what I need to fix. Any suggestions? I dug into node_modules and the undefined object attempting to access a .tap function is compilation.hooks.afterProcessAssets.

@johndanek
Copy link
Author

Still haven't solved this, but upon further investigation I realized that the error appears only when I reference another workspace proejct in .tsconfig, and when I include it as a dependency in package.json. Hmm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant