Skip to content
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

Cannot read property 'addIcon' of undefined #5

Open
airzym opened this issue Feb 6, 2017 · 1 comment
Open

Cannot read property 'addIcon' of undefined #5

airzym opened this issue Feb 6, 2017 · 1 comment

Comments

@airzym
Copy link

airzym commented Feb 6, 2017

After following the workflow integration in the README, when running weback I get the following error:

ERROR in ./src/icons/close.svg
Module build failed: TypeError: Cannot read property 'addIcon' of undefined
    at Object.module.exports (C:\...\node_modules\icons-loader\index.js:8:43)
 @ ./src/icons/index.js 11:13-35
 @ ./src/components/presentation/icon/index.js
 @ ./src/components/presentation/nav/index.js
 @ ./src/components/App.js
 @ ./src/index.js

My webpack:

var webpack = require("webpack");
var path = require("path");
var iconsPlugin = require("icons-loader/IconsPlugin");

module.exports = {
    entry: "./src/index.js",
    output: {
        path: path.resolve("./wwwroot"),
        filename: "bundle.js",
        publicPath: "/"
    },
    module: {
        rules: [
            {
                enforce: "pre",
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "eslint-loader"
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "babel-loader"
            },
            {
                test: /\.scss$/,
                exclude: /node_modules/,
                loaders: ["style-loader", "css-loader", "sass-loader"]
            },
            {
                test: /\.svg$/,
                exclude: /node_modules/,
                use: [{
                    loader: "icons-loader",
                    options: {
                        plugins: [
                            new iconsPlugin({
                                fontName: "icons",
                                normalize: true,
                                formats: ["ttf", "eot", "woff", "svg"]
                            })
                        ]
                    }
                }]
            }
        ]
    }

My project.json

{
  "main": "src/index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "npm run clean && webpack --watch --devtool eval-source-map --progress",
    "build": "npm run clean && webpack --progress",
    "clean": "rimraf wwwroot/bundle.js"
  },
  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-redux": "^5.0.2",
    "redux": "^3.6.0",
    "redux-logger": "^2.8.1",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-core": "^6.22.1",
    "babel-eslint": "^7.1.1",
    "babel-loader": "^6.2.10",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "css-loader": "^0.26.1",
    "eslint": "^3.14.1",
    "eslint-loader": "^1.6.1",
    "eslint-plugin-react": "^6.9.0",
    "icons-loader": "0.0.6",
    "node-sass": "^4.5.0",
    "rimraf": "^2.5.4",
    "sass-loader": "^4.1.1",
    "style-loader": "^0.13.1",
    "webpack": "^2.2.1"
  }
}

Any help on what I'm doing wrong?

@receptiryaki
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants