Skip to content

Commit

Permalink
refactor(theme): performance improvements (#541)
Browse files Browse the repository at this point in the history
* refactor(theme): moved magento configuration to separate non blocking component

* build(theme): removed chunks configuration

* refactor(theme): removed magentoConfiguration component
  • Loading branch information
Frodigo committed Feb 2, 2022
1 parent 59f58b0 commit 1aefd00
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion packages/theme/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import { useRoute, defineComponent, onMounted } from '@nuxtjs/composition-api';
import {
useUser,
} from '@vue-storefront/magento';
import { useMagentoConfiguration } from '~/composables/useMagentoConfiguration';
import AppHeader from '~/components/AppHeader.vue';
import BottomNavigation from '~/components/BottomNavigation.vue';
import TopBar from '~/components/TopBar.vue';
import CartSidebar from '~/components/CartSidebar.vue';
import WishlistSidebar from '~/components/WishlistSidebar.vue';
import LoginModal from '~/components/LoginModal.vue';
import { useMagentoConfiguration } from '~/composables/useMagentoConfiguration';
import Notification from '~/components/Notification';
import AppFooter from '~/components/AppFooter.vue';
Expand Down
31 changes: 0 additions & 31 deletions packages/theme/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,37 +210,6 @@ export default {
}),
}),
],
extend(cfg, ctx) {
// eslint-disable-next-line no-param-reassign
cfg.devtool = ctx.isClient ? 'eval-source-map' : 'inline-source-map';

if (ctx && ctx.isClient) {
// eslint-disable-next-line no-param-reassign
cfg.optimization = {
...cfg.optimization,
mergeDuplicateChunks: true,
splitChunks: {
...cfg.optimization.splitChunks,
automaticNameDelimiter: '.',
chunks: 'all',
enforceSizeThreshold: 50_000,
maxAsyncRequests: 30,
maxInitialRequests: 30,
cacheGroups: {
...cfg.optimization.splitChunks.cacheGroups,
vendor: {
test: /[/\\]node_modules[/\\]/,
reuseExistingChunk: true,
name: (module) => `${module
.context
.match(/[/\\]node_modules[/\\](.*?)([/\\]|$)/)[1]
.replace(/[.@_]/gm, '')}`,
},
},
},
};
}
},
extractCSS: {
allChunks: true,
},
Expand Down

0 comments on commit 1aefd00

Please sign in to comment.