OneZoom / OZtree

OneZoom Tree of Life Explorer
Other
91 stars 20 forks source link

Some hard coded references to /OZtree/static break when running in a different folder #912

Closed davidebbo closed 5 days ago

davidebbo commented 6 days ago

e,g, we run the extinct tree from /OZtree/extinct, so we should be getting files from /OZtree/extinct/static. But we end up with something like:

  <!-- do not change the next line in any way. The exact format is used for partial installs -->
  <div id="OZ_js_modules" data-include="../static/OZTreeModule/dist/OZentry.html ../static/OZTreeModule/dist/OZui.html">
    <script src="/OZtree/static/OZTreeModule/dist/OZentry.6b1f6269acbeddf77f59.js"></script>
    <script src="/OZtree/static/OZTreeModule/dist/OZui.1a267e9832c2cfb41698.js"></script>
  </div>

The likely culprit is this hard coded string:

https://github.com/OneZoom/OZtree/blob/a60f32d5aab6176665ff70ce88c469c7dcc92916/webpack.config.js#L46

From @hyanwong: "Claude.ai says I need to use path.basename(__dirname) in the webpack config, which sounds likely."

hyanwong commented 6 days ago

I think I need something like:

publicPath:  '/' + path.basename(__dirname) + '/static/OZTreeModule/dist/'

So I'll hard code that and see how it goes

davidebbo commented 6 days ago

Yes, that looks right. I tested it on my local tree, which is not running in a subfolder, and it didn't break anything. I suspect it will fix things for the subfolder.

hyanwong commented 6 days ago

Fixed by #914, but @davidebbo noted that there is also some hard-coding in the nginx config:

https://github.com/OneZoom/OZtree/blob/a60f32d5aab6176665ff70ce88c469c7dcc92916/install-nginx.sh#L206

hyanwong commented 5 days ago

Closing in favour of https://github.com/OneZoom/OZtree/issues/915