liady / webpack-node-externals

Easily exclude node modules in Webpack
MIT License
1.3k stars 62 forks source link

TypeError: Path must be a string. Received undefined #54

Open stanleyyylau opened 6 years ago

stanleyyylau commented 6 years ago

This is my code, I use typescript, but having issue with alias, but it turns out that is because I use nodeExternals() that's why the alias but work, but after I add the externals: [nodeExternals({ whitelist: ['client-logger'] })]

I'm getting some other error

2018-09-10T02:29:16Z: identifier="routes:build-info" level="WARN" message="Build Info file not found, and hence not set up to inform actual version of the app." 
Warning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills
path.js:28
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.dirname (path.js:1349:5)
    at Object.<anonymous> (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:928603)
    at t (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:419)
    at Object.<anonymous> (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:928105)
    at t (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:419)
    at Object.defineProperty.value (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:926987)
    at t (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:419)
    at Object.<anonymous> (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:854113)
    at t (/Users/stanley/Desktop/X/epc-photos-pwa-app/assets/server.js:1:419)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! epc-photos-pwa-app@1.0.0 start: `node --use_strict ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the epc-photos-pwa-app@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Check this for more, plese help https://stackoverflow.com/questions/52201186/webpacks-alias-doesnt-work-when-target-module-is-in-node-modules