Code Monkey home page Code Monkey logo

Comments (10)

frankwallis avatar frankwallis commented on June 3, 2024

You're correct, you don't need to install this plugin to run typescript code in 0.16 beta. However the built-in transpiler does not support type-checking. Also see #18 - the long-term plan for jspm is to get rid of the built-in transpilers and have everything done via plugins.

from plugin-typescript.

ifyio avatar ifyio commented on June 3, 2024

Ok I see. I didn't realise I had to add the add a 'package' configuration to config.js to make it work with SystemJS. I have been playing around with plugin-typescript and I have a question. Are self executing bundles the only bundling mechanism that is currently supported? When I do jspm bundle app bundles/bundle.js --inject, the app no longer works and no error is reported.

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

I see the same problem in the example app, the entry file gets passed to plugin-typescript as an empty string which is why nothing happens. It's not clear to me where the problem lies at the moment but I don't think that the plugin should be called at all as the code has already been bundled.

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

More info, the empty string comes from SystemJS loadFromBundle:

/*
  System bundles

  Allows a bundle module to be specified which will be dynamically
  loaded before trying to load a given module.

  For example:
  System.bundles['mybundle'] = ['jquery', 'bootstrap/js/bootstrap']

  Will result in a load to "mybundle" whenever a load to "jquery"
  or "bootstrap/js/bootstrap" is made.

  In this way, the bundle becomes the request that provides the module
*/

(function() {
  // bundles support (just like RequireJS)
  // bundle name is module name of bundle itself
  // bundle is array of modules defined by the bundle
  // when a module in the bundle is requested, the bundle is loaded instead
  // of the form System.bundles['mybundle'] = ['jquery', 'bootstrap/js/bootstrap']
  hookConstructor(function(constructor) {
    return function() {
      constructor.call(this);
      this.bundles = {};
      this.loadedBundles_ = {};
    };
  });

  function loadFromBundle(loader, bundle) {
    return Promise.resolve(loader.normalize(bundle))
    .then(function(normalized) {
      loader.loadedBundles_[normalized] = true;
      loader.bundles[normalized] = loader.bundles[normalized] || loader.bundles[bundle];
      return loader.load(normalized);
    })
    .then(function() {
      return '';
    });
  }

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

And disabling plugin-typescript by changing the loader configuration has no effect.

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

@guybedford - We are seeing an issue with jspm bundle --inject. The issue is that the initial load triggers the bundle to get loaded, but then the initial load continues through the pipeline with the source set to an empty string. If the file is part of a bundle shouldn't the load get aborted somehow and just allow the bundle to register the module?

from plugin-typescript.

guybedford avatar guybedford commented on June 3, 2024

@frankwallis yes an empty string source will pass through the pipeline, but then it will be picked up from the System.defined bundle registry on instantiate return as if it was loaded properly to begin with.

If it's not being picked up that is most likely due to the bundle names not matching right. Make sure that the plugin is outputting anonymous System.register statements, for the loader and builder to name itself. Also there was a file extension bundling issue in systemjs/systemjs#602, which may be affecting this.

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

@guybedford, @ifyio - thanks, yes this does seem to be working now (SystemJS 0.18.6). However it is still loading the plugin when it is not needed as all the typescript has already been compiled inside the bundle?

from plugin-typescript.

guybedford avatar guybedford commented on June 3, 2024

@frankwallis thanks I've posted systemjs/systemjs#670 to track this issue. In the mean time, including the bundle manually right after SystemJS should work here fine though.

from plugin-typescript.

frankwallis avatar frankwallis commented on June 3, 2024

This is now working in [email protected]

from plugin-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.