Skip to content

Use globalName instead of window.$nuxt in the plugin #345

@jjelev

Description

@jjelev

What problem does this feature solve?

Nuxt global is leaking in the final build of application. However many modules reference this directly instead of refering to global name from configuration.

Can we use the globalName option in the nuxt config instead of $nuxt directly ?
https://github.com/nuxt-community/axios-module/blob/dev/lib/plugin.js#L129

const $loading = () => (window.$nuxt && window.$nuxt.$loading && window.$nuxt.$loading.set) ? window.$nuxt.$loading : noopLoading

What does the proposed changes look like?

const $loading = () => (window.<%= options.globalName %> && window.<%= options.globalName %>.$loading && window.<%= options.globalName %>.$loading.set) ? window.<%= options.globalName %>$loading : noopLoading
This feature request is available on Nuxt community (#c347)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions