Question

I have a custom bundlingjs file for a specific page on magento 2, and I'm trying to run this command:

r.js -o pub/static/my_bundling_file.js baseUrl=pub/static/frontend/vendor/theme/locale_tmp dir=pub/static/frontend/vendor/theme/locale_tmp

It's working, but I'm getting some errors like this:

require.js:8 GET http://my-website/static/version1617939686/frontend/vendor/theme/locale/magicproduct.js net::ERR_ABORTED 404 (Not Found)

It's because vendor/theme/locale/magicproduct.js its not on root directory, but it's is vendor/theme/locale/Magiccart_Magicproduct/js/magicproduct directory (Magiccart_Magicproduct).

How can I fix that? Js files are being generated in wrong directory.

my_bundling_file.js

({
    "optimize": "uglify2",
    "generateSourceMaps": true,
    "wrapShim": true,
    "inlineText": true,
    "paths": {
        ...
    },
    "shim": {
        ...
        "magicproduct": {
            "deps": [
                "jquery",
                "magiccart/slick"
            ]
        },
        ...
    },
    "map": {
        "*": {
            ...
            "magicproduct": "Magiccart_Magicproduct/js/magicproduct",
            ...
        }
    },
    "modules": [
        {
            "name": "bundles/shared",
            "create": true,
            "exclude": [],
            "include": [
                ...
                "Magiccart_Magicproduct/js/magicproduct",
                ...
            ]
        },
        ...
    ]
});

thanks

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top