Search code examples
javascriptdebuggingshopware6

Is it possible to enable source js file mapping in shopware 6?


There was an error on the console related to the all.js file, and I'm not sure how to debug it. Is it possible to enable source JS file mapping? This feature can help in debugging the error. Alternatively, are there any other methods to debug the error in the all.js file?

enter image description here


Solution

  • Calling bin/watch-storefront.sh will execute the webpack build in development mode which should include source maps. For the admin panel it's similar. (`watch-administration.sh?)

    Also there are the some more useful npm commands in the package JSON of the storefront.

        "development": "NODE_ENV=development webpack --config webpack.config.js",
    

    So you can do (after running build-storefront once)

    cd vendor/shopware/storefront/Resources/app/storefront/
    npm development