reworkcss / rework-npm

Import CSS from npm modules using rework
BSD 2-Clause "Simplified" License
87 stars 19 forks source link

Does not work with npm3 new Flatness #21

Closed vanthome closed 9 years ago

vanthome commented 9 years ago

For our VCL, we have an Icon Module which is using a Font Awesome integration module to shim the style property. The font awesome module works but the Icon module doesn't as it expects the font awesome module's style here icon/node_modules/vcl-font-awesome/node_modules/font-awesome/css/font-awesome.css but it is here icon/node_modules/font-awesome/css/font-awesome.css. This means the module does not consider the flatness introduces with NPM 3.

@fiws FYI.

conradz commented 9 years ago

The problem is this line. It should read @import "font-awesome/css/font-awesome.css";. Since it is using the relative require using the ./, it will not look in the node_modules folder of parent directories, which will cause this problem.

fiws commented 9 years ago

Edit: @conradz was faster ;)

I just tested this. And this probably is not an issue of rework-npm. rework-npm uses resolve which reports :

Error: Cannot find module './node_modules/font-awesome/css/font-awesome.css' from '/home/fiws/vcl-button/node_modules/vcl-font-awesome'

the first path is not the resolved one. So this resolves to /home/fiws/vcl-button/node_modules/vcl-font-awesome/node_modules/font-awesome/css/font-awesome.css which does not exist, when installing with npm@3.

The problem is that we used an relative path in our vcl-font-awesome module.

@vanthome if your error does not look like this, then you might still had node_modules installed before testing npm@3 or my setup is different.

vanthome commented 9 years ago

@fiws I have the same error and of course installed again with npm3.

vanthome commented 9 years ago

@conradz ok, please close for now, as your hint seems to work.