Skip to content

TypeError [ERR_INVALID_ARG_TYPE] with Webpack 5 and relativePath: true #78

@andersk

Description

@andersk
$ cat >webpack.config.js <<EOF const BundleTracker = require("webpack-bundle-tracker"); module.exports = {  plugins: [new BundleTracker({ relativePath: true })], }; EOF $ touch src.js $ npm i webpack webpack-bundle-tracker webpack-cli  + webpack-cli@4.1.0 + webpack@5.3.2 + webpack-bundle-tracker@1.0.0-alpha.1 added 147 packages from 168 contributors and audited 147 packages in 5.273s  $ npx webpack [webpack-cli] TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received undefined  at validateString (internal/validators.js:124:11)  at Object.relative (path.js:1054:5)  at /tmp/test/node_modules/webpack-bundle-tracker/lib/index.js:138:30  at /tmp/test/node_modules/lodash.foreach/index.js:221:11  at baseForOwn (/tmp/test/node_modules/lodash.foreach/index.js:153:20)  at /tmp/test/node_modules/lodash.foreach/index.js:190:14  at forEach (/tmp/test/node_modules/lodash.foreach/index.js:290:10)  at BundleTrackerPlugin._handleDone (/tmp/test/node_modules/webpack-bundle-tracker/lib/index.js:123:5)  at Hook.eval [as callAsync] (eval at create (/tmp/test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)  at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/tmp/test/node_modules/tapable/lib/Hook.js:18:14) {  code: 'ERR_INVALID_ARG_TYPE' }

At webpack-bundle-tracker/lib/index.js:138, the file object is a SizeOnlySource whose only property is _size, so fileInfo.path is undefined.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions