Closed harpunius closed 3 years ago
I'm a happy webpack-bundle-tracker
user, I was upgrading some old projects and I ran into the same problem.
I tracked it down to a difference in NodeJS versions:
@quinox thanks for the input.
@harpunius could you please try using the latest webpack-bundle-tracker version (1.1.0) and let us know if the error persists?
Just adding the info I've gathered:
For me webpack-bundle-tracker
version 0.4.2-beta worked fine on the old NodeJS whereas version 1.1.0 crashed. Version 0.4.2-beta of the tracker used mkdirp.sync
instead of fs.mkdirSync
, which got changed in d1f8e39c:
Old node:
$ nodejs
> console.log(process.version)
v8.10.0
# what 0.4.2-beta does:
> mkdirp = require('mkdirp')
> mkdirp.sync('/tmp/already-exists')
null
> mkdirp.sync('/tmp/already-exists')
null
# what 1.1.0 does:
> fs.mkdirSync('/tmp/already-exists', { recursive: true })
Error: EEXIST: file already exists, mkdir '/tmp/already-exists'
at Object.fs.mkdirSync (fs.js:885:18)
New node:
> console.log(process.version)
v14.17.1
# what 0.4.2-beta does:
> mkdirp.sync('/tmp/already-exists')
null
> mkdirp.sync('/tmp/already-exists')
null
# what 1.1.0 does:
> fs.mkdirSync('/tmp/already-exists', { recursive: true })
undefined
> fs.mkdirSync('/tmp/already-exists', { recursive: true })
undefined
I don't know the reason behind switching from mkdirp.sync
to fs.mkdirSync
. A possible solution would be keep using fs.mkdirsync
and simply try/catch the call.
Thanks for pinpointing the issue @quinox, that's super-helpful!
I think the reason for not using mkdirp.sync
is avoiding an additional dependency.
Not sure if we should bring it back. Node 10 is now unsupported (out of LTS): https://nodejs.org/en/about/releases/
We should, however, have a CI here to know better which Node versions we support.
I think the reason for not using
mkdirp.sync
is avoiding an additional dependency. Not sure if we should bring it back. Node 10 is now unsupported (out of LTS): https://nodejs.org/en/about/releases/
That sounds entirely reasonable.
We should, however, have a CI here to know better which Node versions we support.
Excellent idea. I see there's already a small Travis configuration but it's not actively used by this project, see #95. I tried it out on my own fork, the build runs but doesn't run the matrix correctly and it also fails. I can polish it up a bit.
@quinox if you can make it work via GitHub Actions or CircleCI, please feel free to open a PR.
Closing as Node 10 is now out of LTS.
Hello,
I followed the rather simple tutorial here https://owais.lone.pw/blog/webpack-plus-reactjs-and-django/ (as referred to in https://github.com/owais/django-webpack-loader). I'm using version 1.0.0-alpha.1
However, my stats file always ended up corrupt (stuck on status: "compile") when building using
webpack --watch
without error. When building without the--watch
argument, I got the error below.My config:
and my project structure
I googled and found two other cases and my setup is identical (no answer on either): https://www.reddit.com/r/webpack/comments/hs94is/webpack_bundle_tracker_not_working/ https://stackoverflow.com/questions/62935574/webpack-bundle-tracker-not-working-error-eexist-file-already-exists-mkdir
I managed to monkey patch it by skipping the recreation of the folder if it already exists in
lib/index:79
. Now the code runs and the stats file is populated as expected.Any ideas as to why? - Best regards