Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref!: complete path to supplement imports #134

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

tolking
Copy link
Member

@tolking tolking commented Oct 26, 2024

Breaking Changes

This PR breaks the type structure of the imports attribute in the configuration. Now you need to add the corresponding file path for the import, so it is not compatible with the previous configuration.

Acceptance type

/** name: export name from the library, path: the file path in the component directory */
imports: Array<[name: string | string[], path: string]>

Migration Guide

If you have previously configured the imports attribute, you need to rewrite the configuration as follows.

export default defineNuxtConfig({
  modules: [
    '@element-plus/nuxt'
  ],
  elementPlus: {
    imports: [
-     'useLocale'
+     ['useLocale', 'es/hooks/use-locale/index.mjs']
    ],
  }
})

Issues

close #133

During local development, all files inside the components were loaded incorrectly. Therefore, it is necessary to specify the corresponding file path for import to avoid loading unused files.

Effect

The number of network requests for a page containing only one ElButton has decreased from 1085 to 264.

After this PR is merged, the number of network requests will be further reduced to 180.

@tolking tolking merged commit 077569c into main Oct 30, 2024
5 checks passed
@tolking tolking deleted the perf/imports-path branch October 30, 2024 08:17
@tolking tolking mentioned this pull request Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

is there a way to only import specific components
1 participant