You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a strange behavior with my scripts.
I have 2 JS files : home.js and product.js for the concerned page.
Both require the common.js file, it works fine on the product page but on the homepage I have this error :
"Uncaught Error: Cannot find module '51'"
More about this error :
var _jquery = require('jquery');
var _jquery2 = _interopRequireDefault(_jquery);
var _common = require('../common/common.js');
var _common2 = _interopRequireDefault(_common);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {'default':obj}; }
(0, _jquery2['default'])(function () {
_common2['default'].init();
});
},{"../common/common.js":88,"jquery":51}]},{},[89]);
But, the JS still works. When I look further on the console, it's apparently the first module I have imported in the home.js script (jquery).
My problem that was throwing "Uncaught Error: Cannot find module..." error was that I didn't noticed that I was including script common.js in my HTML after my factor bundeled files like index.js.
So when I changed the order like so...
<script src="common.js">
<script src="index.js">
everything worked again. Anyway, hope it helps someone.
(in case the problem still occur to someone, I was able to bypass this module not found: 1 error by using defer on my scripts that were loaded before my common.js)
Hi,
I've got a strange behavior with my scripts.
I have 2 JS files : home.js and product.js for the concerned page.
Both require the common.js file, it works fine on the product page but on the homepage I have this error :
"Uncaught Error: Cannot find module '51'"
More about this error :
But, the JS still works. When I look further on the console, it's apparently the first module I have imported in the home.js script (jquery).
Here is my compilation script:
I work on Windows 7 with Node.js v4.2.
The text was updated successfully, but these errors were encountered: