Skip to content

Support "type" field in package.json for ES Modules #5046

Closed
@Worthaboutapig

Description

@Worthaboutapig

What problem does this feature solve?

Currently the vue.config.js must be named exactly that, as far as I can see.

I'm using the "type": "moduel" key in package.json, as I'm using the --experimental-modules feature of Nodejs. However, as vue.config.js is not an ES module, an error is thrown and nothing works.

The suggested solution is to rename the file vue.config.cjs, then node accepts the file is in CJS format and it's happy. This change has been implemented in other tools, and, although technically still experimental, it's not likely to be for long. It's already been out from under a flag once, but had to go back because of a lack of ES Lint support (that's been resolved).

It would be helpful, and presumably wouldn't have an impact elsewhere to accept a file called vue.config.cjs, which is functionally and formatted identically (simply accept a second file name with a different extension).

Additionally, presumably this will have to be done eventually, unless Vue intends never to support ES modules, which wouldn't be helpful.

I'm happy to write up a PR, if someone can point me in the direction of where to look...

What does the proposed API look like?

The config file can be called either vue.config.js or vue.config.cjs. They would be identical, other than the extension.

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