These are chat archives for systemjs/systemjs

4th
Jan 2017
Alexandros Katechis
@akatechis
Jan 04 2017 21:33
Hi all, I suspect this has been answered before, but after spending several hours scouring the github issues, and READMEs for systemJS and plugin-text I can't figure this out: I'm trying to use plugin-text to load an HTML file as a string into a variable using import template from "thing.html"; I've got a section in my config, under meta that says "*.html" : {loader: "text"} and another section under "map" that specifies the text loader's path, but in my console, I see a 404 because it's trying to load from thing.html.js
Am I missing something obvious?
Also trying the following with same results:
  packages: {
    text: {
      defaultExtension: false
    }
  },
  meta: {
    "*.html": {
      loader: "text"
    }
  },
Gert S√łnderby
@gertsonderby
Jan 04 2017 22:41
@akatechis I never did get that to work right, ended up using the ! suffix to do it where needed.
Alexandros Katechis
@akatechis
Jan 04 2017 22:56
@gertsonderby , that's unfortunate. I'm really hoping to get something working for this requireJS project that I'd like to port over to SystemJS. I'm currently trying it out in a separate folder, using JSPM 0.17-beta32 and systemJS 0.20.0 to see if I'll have any success with that
Alexandros Katechis
@akatechis
Jan 04 2017 23:05

Looks like I'm making some progress. I've got the following in my config file:

SystemJS.config({
  paths: {
    "npm:": "jspm_packages/npm/",
    "github:": "jspm_packages/github/",
    "sysjs/": "src/"
  },
  browserConfig: {
    "baseURL": "/"
  },
  devConfig: {
    "map": {
      "plugin-babel": "npm:systemjs-plugin-babel@0.0.18"
    }
  },
  transpiler: "plugin-babel",
  packages: {
    "sysjs": {
      "main": "main.js",
      "format": "esm",
      "meta": {
        "*.js": {
          "loader": "plugin-babel"
        },
        "*.html": {
          "loader": "text"
        }
      }
    }
  }
});

SystemJS.config({
  packageConfigPaths: [
    "npm:@*/*.json",
    "npm:*.json",
    "github:*/*.json"
  ],
  map: {
    "text": "github:systemjs/plugin-text@0.0.9"
  },
  packages: {}
});

I think it's trying to parse the html file as an ES6 module, because I get the following error:
system.src.js:122 Uncaught (in promise) Error: (SystemJS) Unexpected identifier
SyntaxError: Unexpected identifier
at eval (<anonymous>)
Evaluating http://127.0.0.1:8080/lipsum.html
Error loading http://127.0.0.1:8080/main.js
at eval (<anonymous>)
Evaluating http://127.0.0.1:8080/lipsum.html
Error loading http://127.0.0.1:8080/main.js