gowravshekar / font-awesome-webpack

font-awesome package for webpack
MIT License
192 stars 49 forks source link

'Cannot resolve module' error with clean setup. #8

Closed Eptis closed 8 years ago

Eptis commented 8 years ago

I just started a new webpack template project and when I include font-awesome-webpack I get:

ERROR in ./~/font-awesome-webpack/~/css-loader!./~/less-loader!./~/font-awesome-webpack/font-awesome-styles.loader.js!./~/eslint-loader!./~/font-awesome-webpack/font-awesome.config.js
Module build failed: Cannot resolve module 'font-awesome/less/stacked.less' in /Users/eptis/webpack_template/node_modules/font-awesome-webpack
 @ /Users/eptis/webpack_template/node_modules/font-awesome-webpack/font-awesome.config.js (line 14, column 0)
 near lines:
   @import "~font-awesome/less/animated.less";
   @import "~font-awesome/less/stacked.less";

 @ ./~/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-172 13:2-17:4 14:20-178

This is my loaders config, anything I'm doing wrong or might this be a less-loader bug?

loaders: [
      { test: /\.(sass)$/, loaders: ['style', 'css', 'sass?indentedSyntax'], include: STYLES_PATH, exclude: /node_modules/ },
      { test: /\.(css)$/, loaders: ['style', 'css?sourceMap'], exclude: /node_modules/ },
      { test: /\.jsx?$/, loaders: ['babel'], exclude: /node_modules/ },
      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
    ]
gowravshekar commented 8 years ago

It seems you don't have stacked.less file in font-awesome/less/ folder. Install the latest version of font-awesome and check again.

sloria commented 8 years ago

I am also seeing the above error, even after upgrading to the latest font-awesome (4.4.0). I have verified that the stacked.less and animated.less are present.

package_json____projects_cos-projects_osf_node_modules_font-awesome__-_vim

gowravshekar commented 8 years ago

Go to node_modules/font-awesome/less folder and check for the existence of animated.less and stacked.less files.

sloria commented 8 years ago

@gowravshekar Sorry, I updated the comment after you posted your comment; those files do exist.

I found the fix, though: updating to the latest font-awesome-webpack (0.0.4) fixed the issue.