Skip to main content
Corrected spelling, fixed grammer and formatted link
Source Link
Yash Shah
  • 2.5k
  • 1
  • 10
  • 17

Both does the same thing, while a map has an additional advantage to create an alias for entire Magento or a specific module.

The pathPath does not have that advantage. It will consider for the entire Magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case MyVendor_MyModule whenever the same alias jquery will be called within your module js file, it will call MyVendor_MyModule/js/jquery instead of India_Newtheme/js/jquery.

Hope this helps.

Both does the same thing, while a map has an additional advantage to create an alias for entire Magento or a specific module.

The path does not have that advantage. It will consider for the entire Magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case MyVendor_MyModule whenever the same alias jquery will be called within your module js file, it will call MyVendor_MyModule/js/jquery instead of India_Newtheme/js/jquery.

Hope this helps.

Both does the same thing, while a map has an additional advantage to create an alias for entire Magento or a specific module.

Path does not have that advantage. It will consider for the entire Magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case MyVendor_MyModule whenever the same alias jquery will be called within your module js file, it will call MyVendor_MyModule/js/jquery instead of India_Newtheme/js/jquery.

Hope this helps.

Both does the same thing, while a map has an additional advantage to create an alias for entire magentoMagento or a specific module. Path

The path does not have that advantage. It will consider for the entire magentoMagento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*""*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case "MyVendor_MyModule",MyVendor_MyModule whenever the same alias "jquery"jquery will be called within your module js file, it will call "MyVendor_MyModule/js/jquery"MyVendor_MyModule/js/jquery instead of "India_Newtheme/js/jquery"India_Newtheme/js/jquery.

Hope this helps.

Both does the same thing, while map has an additional advantage to create an alias for entire magento or a specific module. Path does not have that advantage. It will consider for entire magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case "MyVendor_MyModule", whenever the same alias "jquery" will be called within your module js file, it will call "MyVendor_MyModule/js/jquery" instead of "India_Newtheme/js/jquery".

Hope this helps.

Both does the same thing, while a map has an additional advantage to create an alias for entire Magento or a specific module.

The path does not have that advantage. It will consider for the entire Magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case MyVendor_MyModule whenever the same alias jquery will be called within your module js file, it will call MyVendor_MyModule/js/jquery instead of India_Newtheme/js/jquery.

Hope this helps.

Source Link
Yash Shah
  • 2.5k
  • 1
  • 10
  • 17

Both does the same thing, while map has an additional advantage to create an alias for entire magento or a specific module. Path does not have that advantage. It will consider for entire magento.

In your code,

var config = {
    map: {
        '*': {
            'jqueryjs': 'India_Newtheme/js/jquery',
            'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
        },
        'MyVendor_MyModule': {
            'jqueryjs': 'MyVendor_MyModule/js/jquery',
        }
    },
    paths: {            
        'jqueryjs': 'India_Newtheme/js/jquery',
        'bootstrapmin': 'India_Newtheme/js/vendor/bootstrap.min'
    }
};

If you are defining something in "*" within map, it will consider for entire Magento, but if the same thing you define within some module name, in our case "MyVendor_MyModule", whenever the same alias "jquery" will be called within your module js file, it will call "MyVendor_MyModule/js/jquery" instead of "India_Newtheme/js/jquery".

Hope this helps.