Skip to content

Commit a2fd231

Browse files
committed
MAGE-999 Rework legacy dependency names to safely point to new namespaced paths without loading modules twice
1 parent 1dd5dfe commit a2fd231

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

view/frontend/requirejs-config.js

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = {
2-
map : {
2+
map : {
33
'*': {
44
// Magento FE libs
55
'algoliaCommon' : 'Algolia_AlgoliaSearch/js/internals/common',
@@ -8,61 +8,57 @@ const config = {
88
'algoliaInsights' : 'Algolia_AlgoliaSearch/js/insights',
99
'algoliaHooks' : 'Algolia_AlgoliaSearch/js/hooks',
1010

11-
// Autocomplete templates
12-
'algoliaAutocompleteProductsHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/products',
13-
'algoliaAutocompletePagesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/pages',
14-
'algoliaAutocompleteCategoriesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/categories',
15-
'algoliaAutocompleteSuggestionsHtml': 'Algolia_AlgoliaSearch/js/template/autocomplete/suggestions',
16-
'algoliaAutocompleteAdditionalHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/additional-section',
11+
// Unbundled template processor
12+
'algoliaTemplateEngine': 'Algolia_AlgoliaSearch/js/internals/template-engine',
1713

18-
// Recommend templates
19-
'algoliaRecommendProductsHtml': 'Algolia_AlgoliaSearch/js/template/recommend/products',
20-
21-
// Unbundling
22-
'algoliaTemplateEngine': 'Algolia_AlgoliaSearch/js/internals/template-engine'
14+
// DEPRECATED - migrated to new paths - these will be removed in a future release
15+
'algoliaAnalytics' : 'algoliaAnalyticsLib',
16+
'recommend' : 'algoliaRecommendLib',
17+
'recommendJs' : 'algoliaRecommendJsLib',
18+
'productsHtml' : 'algoliaAutocompleteProductsHtml',
19+
'pagesHtml' : 'algoliaAutocompletePagesHtml',
20+
'categoriesHtml' : 'algoliaAutocompleteCategoriesHtml',
21+
'suggestionsHtml' : 'algoliaAutocompleteSuggestionsHtml',
22+
'additionalHtml' : 'algoliaAutocompleteAdditionalHtml',
23+
'recommendProductsHtml': 'algoliaRecommendProductsHtml'
2324
}
24-
},
25-
paths : {
25+
}, paths: {
2626
// Core Search UI libs
27-
'algoliaSearchLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-search.min',
28-
'algoliaInstantSearchLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-instantsearch.min',
29-
'algoliaAutocompleteLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-autocomplete.min',
30-
'algoliaAnalyticsLib' : 'Algolia_AlgoliaSearch/js/lib/search-insights.min',
31-
'algoliaRecommendLib' : 'Algolia_AlgoliaSearch/js/lib/recommend.min',
32-
'algoliaRecommendJsLib' : 'Algolia_AlgoliaSearch/js/lib/recommend-js.min',
27+
'algoliaSearchLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-search.min',
28+
'algoliaInstantSearchLib': 'Algolia_AlgoliaSearch/js/lib/algolia-instantsearch.min',
29+
'algoliaAutocompleteLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-autocomplete.min',
30+
'algoliaAnalyticsLib' : 'Algolia_AlgoliaSearch/js/lib/search-insights.min',
31+
'algoliaRecommendLib' : 'Algolia_AlgoliaSearch/js/lib/recommend.min',
32+
'algoliaRecommendJsLib' : 'Algolia_AlgoliaSearch/js/lib/recommend-js.min',
3333

3434
// Autocomplete plugins
3535
'algoliaQuerySuggestionsPluginLib': 'Algolia_AlgoliaSearch/js/lib/query-suggestions-plugin.min',
3636

37-
// Legacy
37+
// Autocomplete templates
38+
'algoliaAutocompleteProductsHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/products',
39+
'algoliaAutocompletePagesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/pages',
40+
'algoliaAutocompleteCategoriesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/categories',
41+
'algoliaAutocompleteSuggestionsHtml': 'Algolia_AlgoliaSearch/js/template/autocomplete/suggestions',
42+
'algoliaAutocompleteAdditionalHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/additional-section',
43+
44+
// Recommend templates
45+
'algoliaRecommendProductsHtml': 'Algolia_AlgoliaSearch/js/template/recommend/products',
46+
47+
// Parser libs for legacy templating
3848
'algoliaMustacheLib': 'Algolia_AlgoliaSearch/js/lib/mustache.min',
3949
'algoliaHoganLib' : 'Algolia_AlgoliaSearch/js/lib/hogan.min',
4050

41-
// DEPRECATED
42-
'algoliaBundle' : 'Algolia_AlgoliaSearch/js/internals/algoliaBundle.min',
43-
'rangeSlider' : 'Algolia_AlgoliaSearch/js/navigation/range-slider-widget',
44-
'recommend' : 'Algolia_AlgoliaSearch/js/lib/recommend.min',
45-
'algoliaAnalytics' : 'Algolia_AlgoliaSearch/js/lib/search-insights.min',
46-
'recommendJs' : 'Algolia_AlgoliaSearch/js/lib/recommend-js.min',
47-
'productsHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/products',
48-
'pagesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/pages',
49-
'categoriesHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/categories',
50-
'suggestionsHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/suggestions',
51-
'additionalHtml' : 'Algolia_AlgoliaSearch/js/template/autocomplete/additional-section',
52-
'recommendProductsHtml': 'Algolia_AlgoliaSearch/js/template/recommend/products',
53-
},
54-
deps : [
55-
'algoliaInstantSearch',
56-
'algoliaInsights'
57-
],
58-
config: {
51+
// DEPRECATED - to be removed in a future release
52+
'algoliaBundle': 'Algolia_AlgoliaSearch/js/internals/algoliaBundle.min',
53+
'rangeSlider' : 'Algolia_AlgoliaSearch/js/navigation/range-slider-widget'
54+
55+
}, deps : ['algoliaInstantSearch', 'algoliaInsights'], config: {
5956
mixins: {
6057
'Magento_Catalog/js/catalog-add-to-cart': {
6158
'Algolia_AlgoliaSearch/js/insights/add-to-cart-mixin': true
6259
}
6360
}
64-
},
65-
shim: {
61+
}, shim : {
6662
'algoliaHoganLib': {
6763
exports: 'Hogan'
6864
}

0 commit comments

Comments
 (0)