ReferenceError: module is not defined after npm install --save-dev webpack?


Why am I getting:

ReferenceError: module is not defined


npm install --save-dev webpack

Someone did mentioned before to uninstall all the react components and reinstall?

So webpack is installed by

npm install --save-dev webpack


meteor add webpack



Can you show us more of your error, like any stack trace you’ve received?

You can either try to integrate webpack with your Meteor app via npm, so using your first npm install approach, or try to integrate an existing Meteor webpack package that takes care of this for your (via meteor add). There is no package available via Atmosphere called “webpack”, and single package names are usually reserved for MDG supported/maintained packages. MDG has no plans to officially support webpack with Meteor (there has been a lot of discussion about webpack support and how it could work, but no concrete plans as of today). If you want to integrate a webpack package, your best bet is to try webpack:webpack. So:

meteor add webpack:webpack

This is the most popular Meteor specific webpack package avilable.


Hi Hugh

Only works when i put back ecmascript :

meter add ecmascript

Other than that, webpack seems to fail

or must I first remove

meteor remove ecmascript 
meteor remove node_modules

and then

meteor add webpack:pack? 

and no webpack.config.js in neither the


directories now? and must these webpack.config.js files be removed once I do the meteor add webpack:webpack etc?

Also in package.json:

  "main": "src/server.js",
  "browser": "src/client.js",

are these correct syntax?

as it complaints that

ERROR in ./src/client.js
Module not found: Error: Cannot resolve module ‘Spark2ACSApp/client’ in C:\Users\seb\PycharmProjects\spark2acs\src