Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Loader string attached to file path #15

Closed
MatteoGabriele opened this issue Jan 15, 2017 · 10 comments
Closed

Loader string attached to file path #15

MatteoGabriele opened this issue Jan 15, 2017 · 10 comments

Comments

@MatteoGabriele
Copy link

when applying loaders with few options, the output of the file path is usually pretty long because is holding the entire loader string with it.
Example of a warning prompt by eslint

Warning in ../blocklevel/blue-next/packages/bcli/~/babel-loader/lib?presets[]=/web/blocklevel/blue-next/packages/bcli/~/babel-preset-es2015/lib/index.js&presets[]=/web/blocklevel/blue-next/packages/bcli/~/babel-preset-stage-2/lib/index.js&plugins[]=/web/blocklevel/blue-next/packages/bcli/~/babel-plugin-transform-runtime/lib!../blocklevel/blue-next/packages/bcli/~/eslint-loader?configFile=/web/blocklevel/blue-next/packages/eslint-config-blocklevel!./src/app/page/home/home.js

Is it possible to extract only the actual file path, in this case /src/app/page/home/home.js, without its entire loader string?

@geowarin
Copy link
Owner

Yes it should be!
Would you be willing to include a repro or, even better, a test so I can have a look ?

@MatteoGabriele
Copy link
Author

I'm working in a private repo and I can't make it public, but I should be able to arrange something that works the same way and publish it somewhere else.
Thanks!

@MatteoGabriele
Copy link
Author

MatteoGabriele commented Jan 15, 2017

I've just created a very simple repo with a webpack structure that shows this issue.
Just install node packages and run npm run dev. I wrote some code that on purpose shows up in the terminal because the linter doesn't allow me to write it.

The code that comes from the vue-loader has a long file path due to its loader that needs to be written as a single string, so combining long loaders, that's the result.

Repository: https://github.com/MatteoGabriele/webpack-dev-server-test/tree/master

image 2017-01-15 at 10 53 17 pm

@geowarin
Copy link
Owner

Should be fixed in 1.1.3.
I will keep this issue open because I could not include a simple repro of your problem.

@geowarin
Copy link
Owner

I mean your repro was superb (thanks btw!), but I don't want to include the whole vue setup in the tests so I have to look for even simpler

@MatteoGabriele
Copy link
Author

Thanks a lot!
I've added vue because was easier to copy paste here and there from the project i was working on. It's working now, the only thing that is still there is that strange list of files at the end, where the original long string is still listed, but i don't know if it's the plugin or some setting of webpack that i have to remove: what you think?

image 2017-01-16 at 7 54 00 am

@MatteoGabriele
Copy link
Author

MatteoGabriele commented Jan 16, 2017

Actually on the repo I wrote for this issue, everything works perfectly, not even that kind of stack trace at the bottom. But in the project I'm writing that part is there. Let me know if you have any idea, in the meantime I will write a less heavy repo to see if i can reproduce it.

@geowarin
Copy link
Owner

geowarin commented Jan 16, 2017

Thanks for your involvement @MatteoGabriele, really appreciated.

I suspect the "stack trace" is the origin of the error. It is unclear in which context webpack provides this information.
We decided to include the origin, if available, in the default formatter but we could decide not to in case of a lint error.

In all cases, simple repros are really important as webpack is kind of a black box we have to build on.

@MatteoGabriele
Copy link
Author

Yeah would be nice to have an optional stack trace log.
Thanks again.

@MatteoGabriele
Copy link
Author

Nothing I tried several setup but, can't reproduce the errors without adding vue, maybe it was the culprit. Let me know just if you are going to make the stack trace optional, that would be nice.

Thanks again for your quick updates.

This was referenced Feb 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants