vuejs/vue-cli

vue.config.js esm support

patarapolw opened this issue ยท 5 comments

What problem does this feature solve?

Instead of

require = require("esm")(module);
const { pugFilters } = require("./src/plugins/render");

I can do import { .pugFilter } from "./src/plugins/render" directly.

Note that I have to do ES6 import from source to enable import in other places in TypeScript.

This is to be on par with Webpack Node API

What does the proposed API look like?

// vue.config.js
import { .pugFilter } from "./src/plugins/render";

There are two possible outcomes for this issue:

  1. For support of a custom module format without changing the file extension, we'd preload a module loader before requiring the config file. We may implement a CLI option for this feature, like the config-register option in webpack-cli.
  2. For support of a custom module format with a custom file extension, we can use the interpret package.

is there plans to allow this now that node v14+ allows esm?

Is this released yet? Which version of vue-cli supports this?

Is this released yet? Which version of vue-cli supports this?

I managed to change filename to vue.config.mjs to use esm. It could work. But somehow the settings about css in the file doesn't take effect.

is there any update for esm support ??