how to properly reference a local repo with package.json / HOWTO Build ES Module Format for Vue Library using Vue CLI

48 views Asked by At

I should make it clear that I'm using vite + bun not vue-cli, NPM or yarn.

The specific package is vue-command https://github.com/ndabAP/vue-command

When run the build command that is used in the library's GitHub workflow (yarn build:lib), it seems to only produce CommonJS (common.js) and UMD (umd.js) formats, but not ES Module format.

yarn build:lib
yarn run v1.22.18
$ vue-cli-service build --target lib --name vue-command ./src/library.js

⠹  Building for production as library (commonjs,umd,umd-min)...```

⠹  Building for production as library (commonjs,umd,umd-min)...

However, there's no ES Module format file (typically with .esm.js or .mjs extension).

I can't figure out how the package on npmjs works at all are there build commands I'm missing?

When I look at the library on npmjs, it seems to be working fine, which makes me wonder if there are additional build commands or configurations that I'm missing to generate an ES Module format.

Questions:

  • How can I configure Vue CLI to build the vue-command library in ES Module format?
  • Is there a specific part of the Vue CLI configuration that I should modify to achieve this?
  • Are there any additional steps or commands that I need to run to generate .esm.js or .mjs files?

Any help or guidance on how to correctly build this Vue library in ES Module format would be greatly appreciated.

0

There are 0 answers