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

Breaks in Electron due to module definition #6

Open
salmonax opened this issue May 4, 2016 · 1 comment
Open

Breaks in Electron due to module definition #6

salmonax opened this issue May 4, 2016 · 1 comment
Assignees

Comments

@salmonax
Copy link

salmonax commented May 4, 2016

The module definition looks like this:

    if (typeof define === 'function' && define.amd) {
        define([ 'module', 'angular' ], function (module, angular) {
            module.exports = factory(angular);
        });
    } else if (typeof module === 'object') {
        module.exports = factory(require('angular'));
    } else {
        if (!root.mp) {
            root.mp = {};
        }

        root.mp.deepBlur = factory(root.angular);
    }

Electron, but not Chrome, satisfies the "typeof module === 'object'" condition, but cannot then find the angular module.

Here is an example of a module definition that does not break Electron, from angular-cache, which uses webpackUniversalModuleDefinition():

    if(typeof exports === 'object' && typeof module === 'object')
        module.exports = factory(require("angular"));
    else if(typeof define === 'function' && define.amd)
        define("angular-cache", ["angular"], factory);
    else if(typeof exports === 'object')
        exports["angularCacheModuleName"] = factory(require("angular"));
    else
        root["angularCacheModuleName"] = factory(root["angular"]);
    }

In the second case, Electron drops down to the last "else" block; forcing deep-blur to do the same fixes the error. Further than that, I can't really say. But I am having to patch around this.

@atesgoral
Copy link
Contributor

Thanks for reporting this!

@atesgoral atesgoral self-assigned this May 6, 2016
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

2 participants