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

Error loading global modules in CSP Production mode #885

Closed
antoniolibrada opened this issue Oct 30, 2015 · 1 comment
Closed

Error loading global modules in CSP Production mode #885

antoniolibrada opened this issue Oct 30, 2015 · 1 comment
Labels

Comments

@antoniolibrada
Copy link

Hello,

I have been working a couple of days on trying to load a global module with SystemJS using "system-csp-production.js" but I had no luck. I have also isolated it in a simple project and I always get the following error:

Uncaught (in promise) Error: http://www.google-analytics.com/analytics.js did not call System.register or AMD define(…)

It works using "system.js" but not with CSP Production.
Here are my configuration files:

System.config({
  baseURL: "/resources",
  defaultJSExtensions: true,
  transpiler: "traceur",
  paths: {
    "github:*": "jspm_packages/github/*"
  },
  meta: {
    "//www.google-analytics.com/analytics.js": {
      "format": "global",
      "exports": "ga"
    }
  },
  map: {
    "traceur": "github:jmcriffey/bower-traceur@0.0.92",
    "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.92"
  }
});

The files are being loaded this way:

<html>
<head>
    <script src="./jspm_packages/system-csp-production.js"></script>
    <script src="./config.js"></script>
    <script>
        System.import('//www.google-analytics.com/analytics.js');
    </script>
</head>
</html>

I don't know if I am doing something wrong, I tried to follow the documentation for this part but I had no luck with it.

Thanks in advance.

@antoniolibrada antoniolibrada changed the title Error oading global modules in CSP Production mode Error loading global modules in CSP Production mode Oct 30, 2015
@guybedford
Copy link
Member

Google analytics doesn't load like a normal script unfortunately. See https://github.com/HeinrichFilter/systemjs-plugin-googlemaps for a plugin aiming to provide this support. Previous discussion at #424.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants