path join not working in webpack5 but it is working with webpack4

Viewed 732

After moving to webpack5 I get an error for this line (this was working with webpack4):

addPath: path.join(process.cwd(), 'public', MISSING_LOCALE_PATH),

and get the following error:

Unhandled Runtime Error
TypeError: path__WEBPACK_IMPORTED_MODULE_1___default(...).join is not a function

After changing to

addPath: `${process.cwd()}/public/${MISSING_LOCALE_PATH}`

it works

any idea how can I get path.join works in webpack5?

1 Answers

Webpack v5 removed automatic node.js pollyfills. See details here and here

Related