Skip to content

Allow devServer to serve a named library on the window object #3637

Open
@adriaanmeuris

Description

@adriaanmeuris

What problem does this feature solve?

CLI service serve does not allow to serve libraries which expose their default export on the window object. CLI service build does:

I'm successfully building a library with a .js file as entry, which exposes the default export to the window object (umd build):
vue-cli-service build --target lib --name mylibrary

The library is availabe as window.mylibrarywhen loading the library in a script tag.

However, this is not possible when working with the devServer, as only the build command accepts the options target and name.

What does the proposed API look like?

vue-cli-service serve --target lib --name mylibrary

The library would would be available to the window object when loaded as a script tag in the devServer page (assuming we're serving a UMD-build)

I currently achieve this by manually adding the library to the window object in code.
Any guidance on how to achieve would be very much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions