module.exportDefault is not a function

Version: Meteor2.0-beta.4, but also a problem with Meteor 1.11, 1.12

With a fresh checkout and meteor npm install, I run up the app, the server is running, and I get a javascript error in the Chrome console:

Uncaught TypeError: module.exportDefault is not a function

It looks like this is something Meteor specific, because a working version of the repo has the same code in the build folder. I am at the end of my tether with this one. Other projects work fine, I don’t understand what is causing it

MemoryRouter.propTypes = {
  initialEntries: PropTypes.array,
  initialIndex: PropTypes.number,
  getUserConfirmation: PropTypes.func,
  keyLength: PropTypes.number,
  children: PropTypes.node
};
module.exportDefault(MemoryRouter);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

},"Router.js":function module(require,exports,module){

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                     //
// node_modules/react-router/es/Router.js                                                                              //
//                                                                                                                     //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Here is my .babelrc file

{
  "env": {
    "test": {
      "presets": ["env", "react", "stage-1"],
      "plugins": [
        [
          "babel-plugin-root-import",
          {
            "paths": [{ "rootPathPrefix": "/" }]
          }
        ]
      ]
    }
  },
  "plugins": [
    [
      "babel-plugin-root-import",
      {
        "paths": [{ "rootPathPrefix": "/" }]
      }
    ]
  ]
}

and dependencies from package.json

  "dependencies": {
    "@babel/runtime": "^7.12.5",
    "@sentry/node": "^5.27.2",
    "@sentry/tracing": "^5.27.2",
    "ag-grid-community": "^20.2.0",
    "ag-grid-react": "^20.2.0",
    "ajv": "^7.0.0-beta.1",
    "assert": "^2.0.0",
    "async": "^2.6.0",
    "aws-sdk": "^2.570.0",
    "aws-sns-sms": "^1.0.2",
    "babel-loader": "^8.2.1",
    "babel-plugin-dynamic-import-node": "^2.3.0",
    "bcrypt": "^4.0.1",
    "body-parser": "^1.19.0",
    "bootstrap": "^4.5.0",
    "bufferutil": "^4.0.1",
    "change-case": "^3.1.0",
    "connected-react-router": "^4.3.0",
    "cookie-parser": "1.4.3",
    "cors": "2.7.1",
    "cron": "^1.7.1",
    "crypto": "^1.0.1",
    "d3": "^6.2.0",
    "dagre-d3": "^0.6.4",
    "date-and-time": "^0.6.2",
    "date-utils": "^1.2.21",
    "debug": "^3.1.0",
    "express": "^4.17.1",
    "faker": "^4.1.0",
    "file-saver": "^1.3.3",
    "formik": "^2.2.0",
    "get-canvas-context": "^1.0.2",
    "glamor": "^2.20.40",
    "gridfs-stream": "^1.1.1",
    "history": "^4.10.1",
    "inspector": "^0.5.0",
    "jsonfile": "^3.0.1",
    "jsonwebtoken": "^8.2.0",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.15",
    "mandrill-api": "^1.0.45",
    "markdown-it": "^8.4.2",
    "markdown-it-mermaid": "^0.2.5",
    "markdown-it-plantuml": "^1.4.1",
    "markdown-loader": "^5.1.0",
    "meteor-node-stubs": "^1.0.1",
    "meteor-redux-middlewares": "^3.0.6",
    "mime-types": "^2.1.27",
    "minimist": "^1.2.0",
    "moment": "^2.26.0",
    "moment-business-days": "^1.1.3",
    "moment-timezone": "^0.5.21",
    "multer": "^1.3.0",
    "mysql": "^2.18.1",
    "mysql2": "^2.1.0",
    "namecase": "^1.1.2",
    "nan": "^2.14.1",
    "node-gyp": "^6.1.0",
    "path": "^0.12.7",
    "pdfkit": "^0.8.3",
    "pdfmake": "^0.1.62",
    "pg-hstore": "^2.3.3",
    "pinjs": "^1.0.3",
    "prismjs": "^1.21.0",
    "prop-types": "^15.7.2",
    "puppeteer": "^2.0.0",
    "randomcolor": "^0.5.4",
    "react": "^16.11.0",
    "react-addons-css-transition-group": "^15.6.2",
    "react-avatar-editor": "^11.0.7",
    "react-bootstrap": "^1.0.1",
    "react-bootstrap-icons": "^1.0.3-alpha5",
    "react-bootstrap-typeahead": "^5.1.1",
    "react-codejar": "^1.0.1",
    "react-data-grid": "^6.1.0",
    "react-data-grid-addons": "^6.1.0",
    "react-datepicker": "^2.9.6",
    "react-dom": "^16.8.4",
    "react-dropzone": "^11.2.0",
    "react-markdown": "^4.0.6",
    "react-markdown-editor-lite": "^1.0.2",
    "react-markdown-it": "^1.0.2",
    "react-pivottable": "^0.10.0",
    "react-pro-sidebar": "^0.4.4",
    "react-radio-group": "^3.0.2",
    "react-redux": "^5.0.6",
    "react-redux-meteor": "^4.5.1",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-s-alert": "^1.4.1",
    "react-simple-tree-menu": "^1.0.6",
    "react-sortable-tree": "^2.8.0",
    "react-sortable-tree-theme-full-node-drag": "^1.1.0",
    "react-sparklines": "^1.7.0",
    "react-split": "^2.0.4",
    "react-split-pane": "^0.1.87",
    "react-table": "^6.9.2",
    "react-tabulator": "^0.13.2",
    "react-tag-autocomplete": "^6.1.0",
    "react-tag-cloud": "^1.3.2",
    "react-time-line": "^0.3.0",
    "react-trello": "^2.2.8",
    "react-ui-tree": "^4.0.0",
    "react-vega": "^7.4.0",
    "react-vertical-timeline-component": "^3.0.2",
    "react-x-editable": "0.0.10-beta",
    "reactabular-table": "^8.12.0",
    "recursive-readdir": "^2.2.2",
    "recursive-readdir-sync": "^1.0.6",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-persist": "^4.8.2",
    "redux-thunk": "^2.3.0",
    "request": "^2.88.0",
    "rxjs": "^6.5.3",
    "rxjs-compat": "^6.5.3",
    "semantic-ui-react": "^0.73.1",
    "semantic-ui-react-numberinput": "^1.3.4",
    "sequelize": "^6.2.3",
    "simpl-schema": "^1.5.6",
    "stack-trace": "0.0.10",
    "stackedit-js": "^1.0.7",
    "svg-text-size": "0.0.1",
    "svg-text-wrap": "0.0.1",
    "svg-to-image": "^1.1.3",
    "tabulator-tables": "^4.7.2",
    "tracker-component": "^1.3.21",
    "underscore": "^1.8.3",
    "underscore.deepclone": "^0.1.3",
    "uniforms": "^3.0.0-rc.3",
    "uniforms-bootstrap4": "^3.0.0-rc.3",
    "uniforms-bridge-json-schema": "^3.0.0-rc.3",
    "uniforms-bridge-simple-schema-2": "^3.0.0-rc.3",
    "uninstall": "0.0.0",
    "utf-8-validate": "^5.0.2",
    "vega": "^5.13.0",
    "vega-lite": "^4.17.0",
    "vertical-timeline-component-for-react": "^1.0.6",
    "winston": "=3.1.0",
    "winston-daily-rotate-file": "^1.7.2",
    "winston-loggly-bulk": "git+https://github.com/loggly/winston-loggly-bulk.git#3.x",
    "xlsx": "^0.16.0",
    "yup": "^0.27.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.7.0",
    "@babel/core": "^7.7.2",
    "@babel/plugin-proposal-class-properties": "^7.7.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
    "@babel/plugin-transform-async-to-generator": "^7.7.0",
    "@babel/plugin-transform-runtime": "^7.6.2",
    "@babel/preset-env": "^7.7.1",
    "@babel/preset-react": "^7.7.0",
    "@babel/register": "^7.7.0",
    "@storybook/addon-actions": "^6.0.26",
    "@storybook/addon-controls": "^6.0.26",
    "@storybook/addon-knobs": "^6.0.26",
    "@storybook/addon-links": "^6.0.26",
    "@storybook/addon-options": "^5.3.21",
    "@storybook/addon-viewport": "^6.0.26",
    "@storybook/addons": "^6.0.26",
    "@storybook/react": "^6.0.26",
    "babel-jest": "^26.0.1",
    "babel-plugin-root-import": "^6.4.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "chai": "^4.1.2",
    "chai-as-promised": "^7.1.1",
    "chai-enzyme": "^0.8.0",
    "child-process": "^1.0.2",
    "core-js": "^3.6.5",
    "css-loader": "^3.6.0",
    "cypress": "^4.5.0",
    "enzyme": "^3.10.0",
    "enzyme-adapter-react-16": "^1.15.1",
    "jest": "^26.0.1",
    "jest-junit-reporter": "^1.1.0",
    "jest-localstorage-mock": "^2.2.0",
    "jest-meteor-stubs": "^1.5.1",
    "mocha": "^7.1.2",
    "newman": "^5.1.2",
    "node-sass": "^4.14.1",
    "react-addons-test-utils": "^15.6.2",
    "react-test-renderer": "^16.11.0",
    "redux-mock-store": "^1.5.3",
    "regenerator-runtime": "^0.11.1",
    "sass-loader": "^9.0.2",
    "sinon": "^6.0.0",
    "storybook-react-router": "^1.0.8"
  }

.meteor/packages file:

meteor-base@1.4.0             # Packages every Meteor app needs to have
mobile-experience@1.1.0       # Packages for a great mobile UX
mongo@1.10.0                   # The database Meteor supports right now
reactive-var@1.0.11            # Reactive variable for tracker
tracker@1.2.0                 # Meteor's client-side reactive programming library

standard-minifier-css@1.7.0-beta200.4   # CSS minifier run for production mode
standard-minifier-js@2.6.0    # JS minifier run for production mode
es5-shim@4.8.0                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.15.0-beta200.4              # Enable ECMAScript2015+ syntax in app code
shell-server@0.5.0            # Server-side component of the `meteor shell` command
fixtures
dynamic-import@0.6.0-beta200.4
accounts-password@1.6.2
accounts-ui@1.3.1
aldeed:collection2-core@2.0.0
mdg:validated-method
react-meteor-data
accounts-base@1.7.0
grove:call-async
practicalmeteor:chai
practicalmeteor:mocha
meteortesting:mocha
dburles:factory
mikkelking:cleaner
meteorhacks:aggregate
ostrio:files
dburles:mongo-collection-instances
underscore@1.0.10
#force-ssl@1.1.0
accounts-github@1.4.3
meteoreact:accounts-semantic
meteoreact:accounts
jquery
akryum:mysql
alanning:roles@2.1.0
static-html
fourseven:scss
hot-module-replacement@0.2.0-beta200.4
mikkelking:slingshot
mikkelking:method-hooks

I have tried updating the babel libraries, but with no wins :frowning:

Any ideas would be appreciated

I upgraded to Meteor 2.2 and I’m seeing this now with bootstrap 3 not rendering properly and font awesome icons not showing. Were you ever able to figure out what was going on?

Uncaught TypeError: module.exportDefault is not a function
at module (modules.js?hash=adfd345a6dd4583360253afc8b7978ed88814adc:365599)
at fileEvaluate (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:346)
at Module.require (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:248)
at Module.moduleLink [as link] (modules.js?hash=adfd345a6dd4583360253afc8b7978ed88814adc:418)
at module (modules.js?hash=adfd345a6dd4583360253afc8b7978ed88814adc:275613)
at fileEvaluate (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:346)
at Module.require (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:248)
at require (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:268)
at module (modules.js?hash=adfd345a6dd4583360253afc8b7978ed88814adc:271217)
at fileEvaluate (modules-runtime.js?hash=834e737986edfacdf20bbc352d7f3f62e50d0b47:346)

I think I got past this to the next error by adding this to the package.json:

{
  ..,
  "meteor": {
    "mainModule": {
      "client": "client/main.js",
      "server": "server/main.js"
    }
  }
} 

Doing that will stop eager loading of files in your /client/... and /server/... folders - one of those may be the cause of the problem

Run into this issue today as well. I have manage to narrow it down to packages that I was trying to update so I’m taking it up with the maintainer and hopefully we can figure out what is causing it. My bet is something strange in the bundling process.

I didn’t solve it as such, other than identifying the npm module that caused the breakage.
I was using https://openbase.com/js/react-pivottable and either Vega or Vega lite A High-Level Grammar of Interactive Graphics | Vega-Lite
I’m not sure if that helps?

I have identified the package as well in my case. I will be looking into it as a previous version of the package did not cause the error.