在SystemJS中使用javascript字符串定义模块

时间:2017-04-25 20:33:45

标签: systemjs

我试图用一串es6代码创建一个SystemJS模块(我知道......但我已经了解了我的理由)。我该怎么做呢?

例如,配置看起来像:

System.config({
  paths: {
    'jquery': "https://code.jquery.com/jquery-3.2.1.min.js",
  },
  transpiler: 'plugin-babel',
  meta: { ...

我试图

const javascriptString = `
    import $ from 'jquery';

    export function doSomething() {
      ...
    };
`;

System.module(javascriptString)
  .then(m => {
    m.doSomething();
  });

我确实看到了System.module方法的一些(标注日期?)引用:herehere。但这似乎并不是由SystemJS实现的。

我怎么能这样做呢?

感谢。

0 个答案:

没有答案