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

Wrong path for style.css #107

Open
brunobg opened this issue Sep 9, 2020 · 4 comments
Open

Wrong path for style.css #107

brunobg opened this issue Sep 9, 2020 · 4 comments
Labels
question Further information is requested vue Only applies to the autocomplete-vue package

Comments

@brunobg
Copy link

brunobg commented Sep 9, 2020

After installing and loading it as a component with import Autocomplete from "@trevoreyre/autocomplete-vue":

ERROR in ./node_modules/@trevoreyre/autocomplete-vue/index.js
Module not found: Error: Can't resolve '../style.css' in 'xxxxxx/node_modules/@trevoreyre/autocomplete-vue'

What works is this:

import Autocomplete from "@trevoreyre/autocomplete-vue/dist/autocomplete.esm";

It seems that you need to fix the package build.

@trevoreyre
Copy link
Owner

Huh, I'm not sure what would be causing this. Are you on the latest, v2.2.0?

If you look at the package.json for the Vue component, you'll see these lines:

  "main": "dist/autocomplete.cjs.js",
  "module": "dist/autocomplete.esm.js",
  "unpkg": "dist/autocomplete.min.js",

So import Autocomplete from '@trevoreyre/autocomplete-vue' should already be redirecting to that dist/autocomplete.esm.js file automatically if you're using a bundler that understands ES modules. Or the .cjs.js files for bundlers that don't. Either way, it shouldn't be encountering that .css import under normal circumstances.

Can you give me a little more info on your bundling setup? If it's webpack or rollup? Can you create a small reproducible example?

@trevoreyre trevoreyre added question Further information is requested vue Only applies to the autocomplete-vue package labels Sep 17, 2020
@brunobg
Copy link
Author

brunobg commented Sep 22, 2020

I'm using it as part of https://github.com/Corollarium/modelarium. I don't have anything else to report, it's a pretty standard use following the docs and using laravel mix to build. But apparently the problem is the index.js file, which is loaded instead of the package.json indication. Perhaps mix is messing up something?

@trevoreyre
Copy link
Owner

I haven't used Laravel Mix before, but if it's an abstraction on top of webpack then yes, that would be my first suspect. Sorry I can't help much more than that.

@brunobg
Copy link
Author

brunobg commented Sep 22, 2020

Thanks, but there's a clear problem that is not caused by any other software: file node_modules/@trevoreyre/autocomplete-vue/index.js includes ../style.css. This path is incorrect, and should be ./dist/style.css.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested vue Only applies to the autocomplete-vue package
Projects
None yet
Development

No branches or pull requests

2 participants