Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
191 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
bcca0ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not asking for help, just sharing my experience in case someone has the same problem (I would be interested to know, though, whether I'm the only one with this problem)
Today I tried the latest master branch and got this js error (just by going to
/static/site_map
from this, but some js functionality like deleting a post doesn't work either):I.e. for some reason
Danbooru
is the empty object...Using
git bisect
I got this as the first bad commit [disclaimer: I had to addgem 'irb'
(not bundled anymore as of ruby 2.6 rubygems/bundler#6929) and comment outgem 'binding_of_caller'
,gem 'better_errors'
, as well as its usage inconfig/environments/development.rb
to get it to run in the first place (otherwise I'd get auninitialized constant RubyVM::DebugInspector (NameError)
), maybe because I'm using my distro's ruby; in my "production" env where I don't do that, the same happens, though].Going one commit back (to 981d56c) fixed it (as it should) and then going back to this commit broke it again (as it also should).
Then out of desparation (i had tried a lot more before this, one time I got the problem to disappear on the latest master somehow just by running random commands, but after cloning the repository anew, it broke again) I edited
yarn.lock
to revert the last change relating towebpack
tothen I ran
rm -rf public/packs
(to be safe),yarn install --frozen-lockfile
and then it worked again after restartingrails server
, so I'm guessing it's a problem with some version ofwebpack > 5.21.2
.By cloning https://github.com/webpack/webpack (to the parent directory of the danbooru repo) and adding the following to
package.json
:Then doing a
git bisect
in the webpack directory and running rails server like the following for every step and reloading/static/site_map
in the browserI get webpack/webpack@9f3950e as the first bad commit, seems a bit too complex for my taste, though...
bcca0ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's some issue with the Webpack
output.library
option not correctly outputting theDanbooru
object. Various Javascript responses (app/views/**/*.js.erb
) use the globalDanbooru
object to call Javascript functions inside the Webpack bundle.danbooru/config/webpack/base.js
Lines 4 to 6 in 0cc1dae
https://webpack.js.org/configuration/output/
bcca0ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a6435f6 is a workaround. I think webpack/webpack#12742 is the bug we're hitting here.