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

strange requirejs mismtach error #96

Open
mafar opened this issue Dec 13, 2016 · 2 comments
Open

strange requirejs mismtach error #96

mafar opened this issue Dec 13, 2016 · 2 comments

Comments

@mafar
Copy link

mafar commented Dec 13, 2016

Hi,
I have this very strange issue where when I start electron via npm run start
I get this error in console. see below.

  1. This error does not break anything as requirejs and application still works fine
  2. This only happens on my laptop. I tested same source on different machines, this error does not come on other machines.
  3. If i compile my code and open gui via forcing developer mode to look at console , this error is not there (on same laptop)
  4. I have tried clearing , caches, uninstalling and installing node.js and node modules again from scratch but it is still there.

my HTML :

  <body >
 
    <script>
      if (window && window.process && window.process.versions['electron']) {
        // is running inside electron not in web-browser
        // 
        // http://electron.atom.io/docs/faq/#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
        // move window.module, window.require inserted in DOM becuase of electron-node integration
        // 
        window.nodeRequire = window.require;
        window.nodeExports = window.exports;
        window.nodeModule = window.module;
        delete window.exports;
        delete window.module;
      }
      window.require = {
        waitSeconds: 0,
        urlArgs: 'bust=' + (new Date()).getTime()
      };
    </script>
    <script src="./js/requirejs/require.js"></script>
 
  </body>

ERROR:

require.js:168 Uncaught Error: Mismatched anonymous define() module: function () {
  var COMPILED = !0, goog = goog || {};
goog.global = this;
goog.isDef = function(a) {
  return void 0 !== a;
};
goog.exportPath_ = function(a, b, c) {
  a = a.split(".");
  c = c || goog.global;
  a[0] in c || !c.execScript || c.execScript("var " + a[0]);
  for (var d;a.length && (d = a.shift());) {
    !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {};
  }
};
goog.define = function(a, b) {
  var c = b;
  COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]));
  goog.exportPath_(a, c);
};
goog.DEBUG = !0;
goog.LOCALE = "en";
goog.TRUSTED_SITE = !0;
goog.STRICT_MODE_COMPATIBLE = !1;
goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;
goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;
goog.provide = function(a) {
  if (goog.isInModuleLoader_()) {
    throw Error("goog.provide can not be used within a goog.module.");
  }
  if (!COMPILED && goog.isProvided_(a)) {
    throw Error('Namespace "' + a + '" already declared.');
  }
  goog.constructNamespace_(a);
};

Error is very long so i am just pasting few lines above.

@mafar
Copy link
Author

mafar commented Dec 14, 2016

I tried this solution as well but problem is sill there
index.js

  mainWindow = new BrowserWindow({
    webPreferences: {
      preload: path.join(__dirname, 'preload.js')
    }
  });

preload.js

window.__devtron = {require: require, process: process}

@stale stale bot added the wontfix label Mar 15, 2017
@zeke zeke removed the wontfix label Mar 15, 2017
@ljcrapo
Copy link

ljcrapo commented Jul 5, 2017

To add efficacy of this bug, I will add that I'm getting the exact same error. When using devtron in any electron window that also uses requirejs, it causes requirejs to throw this error.

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

3 participants