Comments (10)
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.
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.
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.
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.
And disabling plugin-typescript by changing the loader configuration has no effect.
from plugin-typescript.
@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.
@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.
@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.
@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.
This is now working in [email protected]
from plugin-typescript.
Related Issues (20)
- 7.x branch not on npm? HOT 1
- Unexpected export encountered on abstract classes HOT 3
- defaulting to tsconfig: true HOT 6
- tslib_1.__metadata is not a function HOT 2
- Plugin-Typescript doesn't completely strip out Interface import/exports which breaks rollup. HOT 12
- no such file or directory: `plugin-typescript/lib.js` HOT 7
- exports is not defined HOT 3
- js error when loading - cannot read property 'length' of undefined HOT 6
- ENOENT: no such file or directory HOT 1
- Systemjs builder output not working as expected HOT 2
- No console output from Typescript compilation errors HOT 1
- Lookup error at node v8.1.2 npm 5.0.3 HOT 2
- Support for "module": "ESNext" HOT 1
- Not compatible with Typescript 2.6.x package HOT 1
- Getting "Cannot read property 'map' of undefined" HOT 1
- Is it possible to load global script? HOT 6
- tsconfig extends HOT 3
- Error: require is not defined HOT 8
- Does not work with typescript 2.9.1 and above HOT 1
- Getting errors during npm install
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-typescript.