sysgears / apollo-universal-starter-kit

Apollo Universal Starter Kit is a SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
https://apollokit.org
MIT License
1.68k stars 323 forks source link

Webpack doesnt resolve dependencies in node_modules? #637

Closed wojcikiewiczm closed 6 years ago

wojcikiewiczm commented 6 years ago

Hello, I don't know if it is bug or something else but I'm using redux-forms and I encountered weir error. I'm trying to throw error with redux-form (https://redux-form.com/7.2.3/docs/api/submissionerror.md/) but it doesnt work. So I deeply investigated it and found weird error. So as you know redux-form uses handleSubmit function. There is this line

var error = submitError instanceof SubmissionError ? submitError.errors : undefined;
          stopSubmit(error);
          setSubmitFailed.apply(undefined, _toConsumableArray(fields));
          if (error && onSubmitFail) {
            onSubmitFail(error, dispatch, submitError, props);
          } else if (error === undefined) {
            console.error(submitError);
          }
          if (error || onSubmitFail) {
            // if you've provided an onSubmitFail callback, don't re-throw the error
            return error;
          } else {
            throw submitError;
          }

So this submitError instanceof SubmissionError should be true but it's not. The reason why is when I inspect instanceof SubmissionError the SubmissionError throws error

message : "SubmissionError is not defined" stack : "ReferenceError: SubmissionError is not defined↵ at eval (eval at <anonymous> (http://localhost:3000/vendor_web.b9018b4e54577a2861f8_dll.js:447053:23), <anonymous>:1:1)↵ at http://localhost:3000/vendor_web.b9018b4e54577a2861f8_dll.js:447053:23↵ at <anonymous>"

SubmissionError is imported in same file like that import SubmissionError from './SubmissionError';

And also other imports in this file are not defined. So I'm not sure but it look like webpack error or something like that.

Sorry if this error is not related to this starter kit but I think that it is webpack error.

Package.json

{
  "name": "apollo-universal-starter-kit",
  "private": true,
  "version": "1.0.0",
  "main": "src/server",
  "engines": {
    "node": ">= 6.11.1",
    "npm": ">= 3.10.3",
    "yarn": ">= 0.19.0"
  },
  "scripts": {
    "build": "spin build",
    "exp": "spin exp",
    "start": "node --harmony build/server",
    "tests": "cross-env PORT=7070 spin test -t 5000 --full-trace --exit \"src/**/*.spec.js\"",
    "tests:watch": "cross-env PORT=7070 spin test -t 5000 --full-trace --watch \"src/**/*.spec.js\"",
    "test": "flow && npm run tests && npm run lint",
    "lint": "eslint --fix --ext js --ext jsx --ext json src tests tools config",
    "seed": "npm run migrate && knex seed:run",
    "migrate": "knex migrate:latest",
    "rollback": "knex migrate:rollback",
    "watch": "spin watch",
    "heroku-postbuild": "rm -rf build && npm run build && npm run seed",
    "cli": "node tools/cli"
  },
  "lint-staged": {
    "*.{js,jsx,json}": [
      "eslint --fix",
      "git add"
    ]
  },
  "repository": {
    "type": "git",
    "url": "git@github.com:sysgears/apollo-universal-starter-kit.git"
  },
  "bugs": {
    "url": "https://github.com/sysgears/apollo-universal-starter-kit/issues"
  },
  "homepage": "https://github.com/sysgears/apollo-universal-starter-kit",
  "keywords": [
    "apollo",
    "universal",
    "starter",
    "graphql",
    "react",
    "redux"
  ],
  "author": "SysGears INC",
  "license": "MIT",
  "dependencies": {
    "@expo/vector-icons": "^6.1.0",
    "antd": "^2.13.8",
    "apollo-cache-inmemory": "^1.0.0",
    "apollo-client": "^2.0.3",
    "apollo-fetch": "^0.6.0",
    "apollo-fetch-upload": "^1.1.0",
    "apollo-link": "^1.0.3",
    "apollo-link-batch-http": "^1.0.0",
    "apollo-link-ws": "^1.0.0",
    "apollo-logger": "0.1.0",
    "apollo-server-express": "^1.2.0",
    "apollo-upload-server": "^2.0.4",
    "azure-storage": "^2.6.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-minify": "^0.2.0",
    "bcryptjs": "^2.4.3",
    "bitcontrol-ui-kit-contract-watcher": "^0.2.68",
    "bitcontrol-validation": "^0.9.31",
    "bluebird": "^3.5.1",
    "body-parser": "^1.18.2",
    "bootstrap": "4.0.0-beta.2",
    "connect-session-sequelize": "^5.0.0",
    "cors": "^2.8.4",
    "dataloader": "^1.3.0",
    "dotenv": "^4.0.0",
    "enum": "^2.4.0",
    "expo": "^22.0.0",
    "express": "^4.16.2",
    "express-session": "^1.15.6",
    "generate-password": "^1.4.0",
    "graphql": "^0.11.7",
    "graphql-iso-date": "^3.3.0",
    "graphql-subscriptions": "^0.5.4",
    "graphql-tag": "^2.5.0",
    "graphql-tools": "^2.6.1",
    "history": "^4.7.2",
    "humps": "^2.0.1",
    "immutability-helper": "^2.4.0",
    "immutable": "^3.8.2",
    "isomorphic-fetch": "^2.2.1",
    "jsonwebtoken": "^8.1.0",
    "jwt-decode": "^2.2.0",
    "knex": "^0.13.0",
    "lodash": "^4.17.4",
    "minilog": "^3.1.0",
    "moment": "^2.19.1",
    "mysql2": "^1.4.2",
    "node-sass": "^4.5.3",
    "nodemailer": "^4.3.1",
    "nodemailer-express-handlebars": "^2.0.0",
    "passport": "^0.4.0",
    "passport-facebook": "^2.1.1",
    "pdfjs-dist": "^2.0.193",
    "performance-now": "^2.1.0",
    "persistgraphql": "^0.4.0",
    "pg": "^7.3.0",
    "pg-hstore": "^2.3.2",
    "prop-types": "^15.6.0",
    "react": "^16.0.0",
    "react-addons-css-transition-group": "^15.6.2",
    "react-apollo": "^2.0.1",
    "react-cookie": "^2.1.1",
    "react-debounce-input": "^3.1.0",
    "react-dom": "^16.0.0",
    "react-dropzone": "^4.2.1",
    "react-ga": "^2.3.5",
    "react-helmet": "^5.2.0",
    "react-hot-loader": "^3.1.1",
    "react-intl": "^2.4.0",
    "react-lines-ellipsis": "^0.10.0",
    "react-pdf-js": "^3.0.2",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "^5.0.0-alpha.8",
    "react-sortable-hoc": "^0.6.8",
    "react-transition-group": "^2.3.0-beta.0",
    "redux": "^3.7.2",
    "redux-devtools-extension": "^2.13.2",
    "redux-form": "7.2.3",
    "reselect": "^3.0.1",
    "sequelize": "^4.22.6",
    "sequelize-log-syntax-colors": "^1.0.0",
    "serialize-javascript": "^1.4.0",
    "source-map-support": "^0.5.0",
    "styled-components": "^2.2.2",
    "subscriptions-transport-ws": "^0.9.1",
    "svg-url-loader": "^2.3.1",
    "tedious": "^2.0.0",
    "universal-cookie-express": "^2.1.0",
    "uuid": "^3.1.0"
  },
  "devDependencies": {
    "apollo-utilities": "^1.0.0",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.0.1",
    "babel-loader": "^7.1.2",
    "babel-plugin-styled-components": "^1.2.1",
    "babel-plugin-tcomb": "^0.3.26",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.10",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-flow": "^6.23.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-native": "^4.0.0",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "caporal": "^0.8.0",
    "chai": "^4.1.2",
    "chai-http": "^3.0.0",
    "compression": "^1.7.1",
    "connect": "^3.6.5",
    "cross-env": "^5.1.0",
    "css-loader": "^0.28.7",
    "enzyme": "^3.1.0",
    "enzyme-adapter-react-16": "^1.0.2",
    "eslint": "^4.9.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-import-resolver-webpack": "^0.8.3",
    "eslint-plugin-flowtype": "^2.39.1",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-json": "^1.2.0",
    "eslint-plugin-jsx-a11y": "6.0.2",
    "eslint-plugin-mocha": "^4.11.0",
    "eslint-plugin-prettier": "^2.5.0",
    "eslint-plugin-react": "^7.4.0",
    "exp": "45.0.2",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.5",
    "flow-bin": "^0.57.3",
    "freeport-async": "^1.1.1",
    "fs-extra": "^4.0.2",
    "haul": "1.0.0-beta.7",
    "html-webpack-plugin": "^2.30.1",
    "http-proxy-middleware": "^0.17.4",
    "husky": "^0.14.3",
    "ignore-loader": "^0.1.2",
    "image-size": "^0.6.1",
    "ip": "^1.1.5",
    "isomorphic-style-loader": "^4.0.0",
    "jsdom": "^11.3.0",
    "less": "^2.7.3",
    "less-loader": "^4.0.5",
    "lint-staged": "^4.3.0",
    "mkdirp": "^0.5.1",
    "mocha": "^4.0.1",
    "mocha-steps": "^1.1.0",
    "mocha-webpack": "^0.7.0",
    "node-sass": "^4.5.3",
    "openurl": "^1.1.1",
    "persistgraphql-webpack-plugin": "^0.4.4",
    "postcss-loader": "^2.0.8",
    "prettier": "^1.10.2",
    "qrcode-terminal": "^0.11.0",
    "raw-loader": "^0.5.1",
    "react-addons-test-utils": "^16.0.0-alpha.3",
    "react-test-renderer": "^16.0.0",
    "resolve-url-loader": "^2.2.1",
    "sass-loader": "^6.0.6",
    "sequelize-cli": "^3.2.0",
    "shelljs": "^0.7.8",
    "source-list-map": "^2.0.0",
    "spinjs": "0.4.53",
    "style-loader": "^0.19.0",
    "tcomb": "^3.2.24",
    "url-loader": "^0.6.2",
    "wait-on": "^2.0.2",
    "webpack": "^3.8.1",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-dev-server": "^2.9.3",
    "webpack-hot-middleware": "^2.20.0",
    "webpack-manifest-plugin": "^1.3.2",
    "webpack-merge": "^4.1.0",
    "webpack-node-externals": "^1.6.0",
    "webpack-sources": "^1.0.1",
    "webpack-virtual-modules": "^0.1.8",
    "ws": "^3.2.0",
    "xdl": "^46.0.1"
  },
  "resolutions": {
    "graphql": "^0.11.7"
  },
  "greenkeeper": {
    "ignore": []
  }
}
larixer commented 6 years ago

This issue report is invalid. Please open issues by providing full error message only and relevant excerpts of your code.

wojcikiewiczm commented 6 years ago

I provided full error. Nothing else to show. But I manage to fix it by updating spinjs from 0.4.53 to latest 0.4.95 don't know why it works only with the newest version it's weird..

larixer commented 6 years ago

@wojcikiewiczm Oh, I'm very sorry, I misread the error in your message. Glad it works for you now

larixer commented 6 years ago

@wojcikiewiczm I think it started to work for you because it might be related to this issue: https://github.com/sysgears/spinjs/issues/32