Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when using --target lib and the entry file is missing #1051

Closed
fjc0k opened this issue Mar 29, 2018 · 4 comments
Closed

Comments

@fjc0k
Copy link

fjc0k commented Mar 29, 2018

Version

3.0.0-beta.6

Reproduction link

https://github.com/fjc0k/vue-cli-lib-test

Steps to reproduce

  1. clone
  2. yarn
  3. yarn run build

What is expected?

build success

What is actually happening?

build failed with error:

This dependency was not found:

* ~entry in ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js

To install it, you can run: npm install --save ~entry

notice: the main.js file is not default

@LinusBorg
Copy link
Member

LinusBorg commented Mar 29, 2018

The entry can be either a .js or a .vue file. If no entry is specified, src/App.vue will be used.

Your build command should look like this:

"build": "vue-cli-service build --target lib --name ff src/main.js",

bildschirmfoto 2018-03-29 um 21 11 26

We should definitely show a better error when the entry file isnt' found. I would assume we have such a check, but it comes after the config setup that breaks with the shown error when building a lib.

@LinusBorg LinusBorg changed the title This dependency was not found: * ~entry in ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js Improve error message when using --target lib and the entry file is missing Mar 29, 2018
@LinusBorg
Copy link
Member

We should probably check if the entry file exists right around here:

https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/index.js#L30

@markfknight
Copy link

Will there be support for TypeScript (.ts) files in the future?

@lunsdorf
Copy link

I ran into this issue today (using @vue/cli-service in version 4.4.1) and spent quite some time finding the issue and therefor decided to share my findings.

This error can occur if you override the alias config in vue.config.js. So instead of doing this:

config.resolve.alias = myAliasConfig

you should do something like this:

config.resolve.alias = { ...config.resolve.alias, ...myAliasConfig }

This also fixes the same issue when building web-components and the error is something like ~root/src/app.vue?shadow in ./node_modules/@vue/cli-service/lib/commands/build/entry-wc.js.

I hope this saves some of you a lot of time debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants