Skip to content

Support for config.cjs and/or ES6 module #2466

Open
@akauppi

Description

@akauppi

Feature request

Ability to name the configuration file config.cjs (for CommonJS), and/or express configuration as an ES6 module.

What problem does this feature solve?

Currently (VuePress 1.5.2) it seems the configuration file must be config.js and that file must be given with CommonJS export syntax.

The world is in between two module eras, and projects start using ES6 modules. There is a convention about doing this in Node, defining "type": "module" in package.json (to default .js to ES6 module loading) and a recommendation of naming files explicitly to .cjs for CommonJS and .mjs for ES6.

VuePress is not acting according to such convention.

What does the proposed API look like?

One would be able to get configuration via either config.cjs, config.mjs or the default interpretation of config.js. At the least, I would like config.cjs to be found.

How should this be implemented in your opinion?

Unfortunately, I don't have insight about this.

Are you willing to work on this yourself?

I can help test a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions