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

Plugins Not Running during less-loader #188

Closed
MarkJPerry opened this Issue Apr 10, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@MarkJPerry

I am trying to use the re-write import plugin to solve some issues with the semantic-ui less files and themes.

See here:
http://neekey.net/2016/12/09/integrate-react-webpack-with-semantic-ui-and-theming/
https://www.artembutusov.com/webpack-semantic-ui/

My webpack build fails with the following message: `Can't resolve '../../theme.config'

In the repo below I am trying to replace the other.less import with one to foo.less. As you will see the foo.less file is not imported correctly.

Minimal Example Repo:
https://github.com/MarkJPerry/less-loader-plugin-bug

Any assistance greatly appreciated.

@MarkPerryBV

This comment has been minimized.

Show comment
Hide comment
@MarkPerryBV

MarkPerryBV Apr 12, 2017

So I now know why the less-plugin-rewrite-import plugin is not working. It's all to do with the paths setting in the less-loader and the choice between the WebPackFileManager and the LessFileManager.

Not sure how to resolve my issue now. Will have a think and update.

Update 2:
Turns out that the way to fix it was to use the LessFileManager to resolve less dependancies instead of the WebPackFileManager, this means I supplied the "paths" option to enable it. That then meant I can use the ImportReWritePlugin to rewrite some paths I needed and I managed to get it working.

So not a bug but could be better documented in the less-loader readme and the less-rewriteimport plugin. I will submit a PR once my head finishes exploding.

Please close as this is not a bug.

MarkPerryBV commented Apr 12, 2017

So I now know why the less-plugin-rewrite-import plugin is not working. It's all to do with the paths setting in the less-loader and the choice between the WebPackFileManager and the LessFileManager.

Not sure how to resolve my issue now. Will have a think and update.

Update 2:
Turns out that the way to fix it was to use the LessFileManager to resolve less dependancies instead of the WebPackFileManager, this means I supplied the "paths" option to enable it. That then meant I can use the ImportReWritePlugin to rewrite some paths I needed and I managed to get it working.

So not a bug but could be better documented in the less-loader readme and the less-rewriteimport plugin. I will submit a PR once my head finishes exploding.

Please close as this is not a bug.

@neekey

This comment has been minimized.

Show comment
Hide comment
@neekey

neekey Jun 27, 2017

Thanks for you idea! @MarkPerryBV

I just followed your idea and fixed this in my tutorial, and have updated the demo project as well, should work like a charm now!

neekey commented Jun 27, 2017

Thanks for you idea! @MarkPerryBV

I just followed your idea and fixed this in my tutorial, and have updated the demo project as well, should work like a charm now!

@michaelchihuyho

This comment has been minimized.

Show comment
Hide comment
@michaelchihuyho

michaelchihuyho Jul 2, 2017

I ran into the same issue as @MarkPerryBV when using less-plugin-npm-import. I ended up setting paths even though I wasn't really using paths for its intended purpose. I just wanted to make sure that WebpackFileManager didn't get used. Looking through the issues I can see that others are probably running into the same thing.

One way less-loader could solve this is to be smart and call install on plugins and see if they call addFileManager() like this. If they do, don't use the WebpackFileManager. This seems kind of messy though.

Another way would be to just expose another option like useWebpackResolver which could be used to explicitly turn off WebpackFileManager and add a note about it in the README.

I ran into the same issue as @MarkPerryBV when using less-plugin-npm-import. I ended up setting paths even though I wasn't really using paths for its intended purpose. I just wanted to make sure that WebpackFileManager didn't get used. Looking through the issues I can see that others are probably running into the same thing.

One way less-loader could solve this is to be smart and call install on plugins and see if they call addFileManager() like this. If they do, don't use the WebpackFileManager. This seems kind of messy though.

Another way would be to just expose another option like useWebpackResolver which could be used to explicitly turn off WebpackFileManager and add a note about it in the README.

@shabunc

This comment has been minimized.

Show comment
Hide comment
@shabunc

shabunc Apr 13, 2018

@michael-ciniawsky just to be sure - this is closed because it's not considered an issue, it's an obsolete issue or there's known workaround. It seem to me that this is actually a big deal - any less plugin which relieis on FileManager is not working and it's extremely difficult to figure out what's going on.

shabunc commented Apr 13, 2018

@michael-ciniawsky just to be sure - this is closed because it's not considered an issue, it's an obsolete issue or there's known workaround. It seem to me that this is actually a big deal - any less plugin which relieis on FileManager is not working and it's extremely difficult to figure out what's going on.

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