Giter Club home page Giter Club logo

Comments (8)

nocive avatar nocive commented on June 24, 2024 1

Looks like it's related with the single runtime chunk functionality, disabling it solves the problem.

from sonataadminbundle.

virtualize avatar virtualize commented on June 24, 2024 1

I can confirm this bug. It seems to come from sonata/form-extensions >= 2.0

Starting with release 4.24.0, SonataAdmin allowed "sonata-project/form-extensions": "^1.15 || ^2.0".
Downgrading to "sonata-project/form-extensions": "^1.15" removes the error.

I suppose this has something to do with switch to stimulus controllers and/or the switch to the new eonasdan/bootstrap-datetimepicker in sonata-project/form-extensions 2.0

from sonataadminbundle.

VincentLanglet avatar VincentLanglet commented on June 24, 2024

Maybe @jordisala1991 could help since he introduced stimulus...
but I would say it's hard without the related files...
(Is it because of .addEntry('main', './assets/admin/main.js') ?)

You could try to build less file, until it works to see which are the one with an issue. (Or at least having a smaller reproducer)

from sonataadminbundle.

nocive avatar nocive commented on June 24, 2024

@VincentLanglet I can also provide the contents of main.js or at least the main skeleton of the file (I'll append it to the ticket):

main.js
// css imports
import '../../public/bundles/mybundle/css/custom.css'; // just a plain css file, no sass/less or other transformers.

// javascript imports
import Masonry from 'masonry-layout';

window.onload = function() {
    const container = document.querySelector('.masonry-grid');

    if (container) {
        new Masonry(container, {
            itemSelector: '.grid-item',
            columnWidth: '.grid-item'
        });
    }
}

// other irrelevant code

EDIT: also, to be 100% clear, the code builds fine, the error happens ONLY during runtime in the browser's console.

from sonataadminbundle.

nocive avatar nocive commented on June 24, 2024

Removing main.js does remove the presence of the second error.
If I remove fos_routing then both errors go away, but I'm also left without application javascript code 😅

This is looking more like a transpilation problem related to babel/webpack/foobar.

from sonataadminbundle.

nocive avatar nocive commented on June 24, 2024

Still looking for help here, I've tried the latest SonataAdminBundle minor version and played around with the settings in webpack config to no avail. I found similar error reports which seem to suggest that perhaps core-js and webpack/babel are interfering with each other.

Perhaps my package.json dependencies need to match the same ones as used in Sonata, so that they can be compatible?
I'll attach the contents of package.json to the issue report, if that helps narrow this down.

Going back to SonataAdmin 4.23 always makes the issue go away.

from sonataadminbundle.

VincentLanglet avatar VincentLanglet commented on June 24, 2024

Looks like it's related with the single runtime chunk functionality, disabling it solves the problem.

Would it be worth opening an issue on webpack or webpack-encore side then ?

from sonataadminbundle.

nocive avatar nocive commented on June 24, 2024

Not sure if this can be labeled as an issue upstream or an issue with our particular setup to be honest.
I'm a bit out of my depth when it comes to webpack black magic.

I ended up having to update the admin webpack encore config to:

-    .enableSingleRuntimeChunk()
+    .disableSingleRuntimeChunk()

and add an additional import for moment using expose-loader to have it available on the global scope for legacy code:

+import moment from 'expose-loader?exposes=moment!moment';

The symfony recommendation is to use single runtime chunk though, hence why we had this to begin with.
Why was it working before the introduction of stimulus and not after is beyond me.

from sonataadminbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.