Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Plugin/Module not registered correctly after transpiling to ES5 #844

Open
xwisdom opened this issue Apr 12, 2018 · 0 comments
Open

Plugin/Module not registered correctly after transpiling to ES5 #844

xwisdom opened this issue Apr 12, 2018 · 0 comments

Comments

@xwisdom
Copy link

xwisdom commented Apr 12, 2018

Hello,

I'm getting the following error in the browser after loading code generated by the builder:

Error: Module instantiation did not call an anonymous or correctly named System.register.
  Instantiating http://127.0.0.1:81/path/to/data!pluginx

Here's the Javascript code and SystemJS configuration:

import myData from 'path/to/data!pluginx';

console.log(myData)
SystemJs.config({
	map: {
		pluginx: 'assets/scripts/pluginx.js'
	}
})

The builder generates the following output:

System.registerDynamic('path/to/data!assets/scripts/pluginx.js', ['lib/dataconverter.js'], false, function ($__require, $__exports, $__module) {
  return (function (obj) {
    return obj.convertData('path/to/data');
  }).call(this, $__require('lib/dataconverter.js'));
});

System.register('app/modules/main.js', ['path/to/data!pluginx'], function (_export, _context) {
  "use strict";

  var myData;
  return {
    setters: [function (_pathToDataPluginx) {
      myData = _pathToDataPluginx.default;
    }],
    execute: function () {

      console.log;

    }
  };
});

I think SystemJS is trying to load "path/to/data!pluginx" from the server because it not registered.

If I change System.registerDynamic('path/to/data!assets/scripts/pluginx.js',...) to System.registerDynamic('path/to/data!pluginx.js',...) then it works just fine.

Why is the builder generating code to register path/to/data!assets/scripts/pluginx.js instead of path/to/data!pluginx? Is this a bug?

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

No branches or pull requests

1 participant