Javascript wrong in yarn start (while correct in build or build:production)

Hi
I’ve a clean install of Sage 9.0.9, I simply added this code:

HTML in a page.blade.php tamplate

  <div class="container">
    <div class="h2-test">TEST TEST TEST</div>
  </div>

CSS in main.scss

.container {
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  background: red;
}

JS in common.js

export default {
  init() {
    // JavaScript to be fired on all pages
  },
  finalize() {
    // JavaScript to be fired on all pages, after page specific JS is fired

    let slide_1 = document.querySelector('.h2-test');
    console.log(slide_1.offsetWidth);
  },
};

The console.log simply outputs the width of that element.
While using yarn start it outputs a wrong value
Instead with yarn build or yarn build:production the value is correct

Also, if I try to get a custom property from JS in yarn start it returns empty string while in build it works.

It seems an awful bug? How to solve?

e class='quote' data-post="1" data-topic="20067">
Note: Changed Sage 9.2 to 9.1 (as 9.0.10 is the current release in master). Updated Sage 9.x You can now try out the Sage PR branch for webpack 5 and updated dependencies. The sage-installer which is used by Sage 9.x for adding framework support was also updated to add the right configuration and styles. Bootstrap 5 (Beta2) has been added for selection. Tailwind 2 is used now. Trying it out now! To prevent siloing of existing working forks of Sage 9 + (insert framework), please try this set…