netlify-lambda: [BUG] Babel-loader - hidden dependency
after running command ./node_modules/.bin/netlify-lambda build functions-source/
I god
netlify-lambda: Building functions
Hash: 2f36233598c9262552e4
Version: webpack 4.20.2
Time: 1142ms
Built at: 2018-10-16 12:47:52
Asset Size Chunks Chunk Names
rating.js 1.21 KiB 0 rating
Entrypoint rating = rating.js
[0] ./rating.js 254 bytes {0} [built] [failed] [1 error]
ERROR in ./rating.js
Module build failed (from ../node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'babel' of undefined
at Object.module.exports (/Users/nikolay/Projects/autokwix/node_modules/babel-loader/lib/index.js:103:36)
after installing babel-loader - it started to work
how on earth?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (8 by maintainers)
I have been getting this same issue on a new create-react-app and was wondering why it wasn’t working until finally doing a
yarn add -D babel-loaderand starting thenetlify-lambda servecommand all over again to which it works.My conclusion is that it might have to do with
react-scripts: 2.x.x.My error was more along the lines of:
ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/Users/[redacted]/Desktop/test/src/functions'Update: I figured it out. To anyone out there using react-static (older versions ~before v6.x.x) with netlify-lambda (v0.4.0), I needed to upgrade both my versions of react-static(now v7.x.x) and netlify lambda(now v1.4.5).
Hi @sw-yx I had lambda
^0.4.0and it started to fail all of a sudden, without touching any config nor the functions and experienced this during build:I upgraded to netlify-lambda:
^1.4.5and yarn added -D babel-loader:^8.0.5but the build functions failed and it seems to have something to do with babel-loader 😦@sw-yx Seems as if it’s a mixed bag.
Ex. I’ll get the
ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/Users/[redacted]/Desktop/test/src/functions'from a clean install but when I install the babel loader I get:which leads me to believe it has to do with version mismatch as from what I’ve gathered
netlify-lambdabrings its own version ofbabel-loader.If I delete the
yarn.lockfile andnode_modulethen redo ayarnto reinstall everything and run thenetlify-lambda serve src/lambdait begins to work.Im not as familiar with babel but I’ll see what can be done to get it from messing up like so.
Another thing I’ve noticed is using Yarn Plug and Play it gives the same error with no
babel-loaderand no matter what I do it will not work at all even if I try installing it.