gowravshekar/font-awesome-webpack

Doesn't work with Webpack 2

unyo opened this issue ยท 21 comments

unyo commented

Currently getting the following error using Webpack 2:

Uncaught Error: Cannot find module "style!css!less!./font-awesome-styles!./font-awesome.config.js"

Module not found: Error: Can't resolve './font-awesome-styles' in '/Users/unyo/ocean/node_modules/font-awesome-webpack'
resolve './font-awesome-styles' in '/Users/unyo/ocean/node_modules/font-awesome-webpack'

unyo commented

I wonder how you link issues (sorry first pull request) #25

Yup, same problem here.

I have the same problem as well.

+1

I created a temporary fork until this issue gets resolved: https://www.npmjs.com/package/font-awesome-webpack2

hwupu commented

@tamasd bravo!

Ugarz commented

Hey @tamasd thanks dude ๐Ÿป !

@tamasd Is there a specific reason to use the less version? I came across an annoying issue when using npm shrinkwrap, which was caused by less and less-loader.

@unsafecode in my fork I only merged a very small PR that makes it work with the newer webpack versions. Your issue is present in the original package as well.

@tamasd Can't resolve 'font-awesome/less/stacked.less

aelkz commented

Same error for me.. Can't find a solution!

Error: Cannot find module 'style-loader!css-loader!less-loader!./font-awesome-styles.loader!./font-awesome.config.js' from ...

my dependencies in package.json:

"dependencies": {
"bulma": "^0.3.1",
"css": "^2.2.1",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"font-awesome": "^4.7.0",
"font-awesome-webpack2": "0.0.6",
"less": "^2.7.2",
"less-loader": "^2.2.3",
"style-loader": "^0.13.1",
"sweetalert": "^1.1.3",
"url-loader": "^0.5.7",
"vue": "^2.1.0",
"vue-resource": "^1.0.3"
},

and require('font-awesome-webpack2') in main.js file.

I'm experiencing the same problem.
I add

      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }

to webpack.config.js and added require("font-awesome-webpack2"); to index.js.
That results in

ERROR in Cannot find module 'less'
 @ ./~/font-awesome-webpack/~/style-loader!./~/font-awesome-webpack/~/css-loader!./~/less-loader!./~/font-awesome-webpack/font-awesome-styles.loader.js!./~/font-awesome-webpack/font-awesome.config.js 4:14-144 13:2-17:4 14:20-150

I do not have less installed.

What is the way forward?

@tamasd have you figured out how to use extract-text-webpack-plugin with your fork and webpack 2? It works with styleLoader: 'style-loader!css-loader!less-loader', but haven't figured how to make extract-text work, either errors or all fa-* styles end up in js...

This should be resolved by #23 which is now merged. I will close this after a #23 has been released.

@tamasd would you like to merge your fork back in?

No, afaik there's nothing in important in it anymore.

I'm closing this issue as it does work with webpack2 now. If anyone has any outstanding issues in this ticket, please open them as new separate issues.

@wolfadex I am still getting the exact same errors. Do you have a repository that shows this working? I have been working on this following the npm instructions for over an hour now.

https://www.npmjs.com/package/font-awesome-sass-loader

the bug is that they have forgotten to add the original 'font awesome' npm as a dependency

If your missing stacked.less or other files, npm install font-awesome. As the poster above said, its missing font-awesome as a dependency. Same with anything else, if your missing "less" or "url-loader" or whatever, just install --save-dev it

npm i --save font-awesome
should resolve your problems. Regards, Andrey.