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

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

@xwisdom

Description

@xwisdom

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions