-
Notifications
You must be signed in to change notification settings - Fork 21
Doesnt work with jspm 0.17.0-beta.22 #36
Comments
Which version of the text plugin are you using here? Make sure you're running the latest 0.0.8. |
Hi. I have 0.0.8 installed "text": "github:systemjs/plugin-text@^0.0.8", Ill try and do some more debugging to see whats up |
So i managed to figure this out. After the upgrade something put this in my jspm.config.js file typescriptOptions: {
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}, Removing the module line seems to work so it should look like this typescriptOptions: {
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}, Maybe someone can shed some better light on the significance of that parameter? Feel free to close this issue |
@guybedford I believe the issue stems from the following change f6ba200 I'm not entirely sure I understand the reason for the change, but the effect is that importing text via default import syntax only works when either
I tried with both [email protected] and 2.0.0, and with the latest dev build via both [email protected] and 4.0.16. I also tested via the command line compiler. TypeScript always attempts to access the export named default, but the text plugin generates an anonymous define unless builder is defined. I think plugin-typescript may have some magic to make this work, but I'm not sure. Personally, I didn't run into this issue because I was always transpiling with "module": "system". I think this is a pretty serious issue. It is very surprising because there are several implicit behaviors at work in TypeScript, in plugin-text, and plugin-typescript which interact oddly. It may be worth mentioning that I am currently working on a project which uses Webpack (not my choice or preference) and TypeScript. In Webpack, the @el-davo |
I can't seem to replicate this here at all. Here's the steps I took: Running jspm 0.17-beta.22 and plugin-typescript 5.0.8 against Typescript 2.0.0. System.config({
meta: { '*.txt': { loader: 'text' } }
}); test.js import text from 'file.txt';
console.log(text); with a What can I do to replicate this further? |
Perhaps try setting |
I do observe the same issue, I use [email protected] and [email protected]. |
@crystalbyte If the JavaScript that executes references the |
@aluanhaddad Thanks, I will check that and get back to you. |
This project exports as |
(note that the AMD form returned when |
@guybedford #34 is unrelated. Specifically, the issue there was TypeScript providing a static error because the typechecker did not understand that the HTML imports were consumed as synthetic modules created by the plugin at runtime. That issue was purely a static type checking issue and did not affect runtime behavior in any way, it was just annoying because you had to use a workaround to silence the type checker (fixed in TS 2.0). I think that, as you say, there must be something wrong with the interop which translates the resulting AMD module endowing it with a default property. The code generated by the typescript compiler for import template from './template.html'; accesses the default property of the module namespace object and has not changed for at least 9 months. var template = template_1.default; Sorry for being long-winded, but I just wanted to clarify that #34 is completely unrelated. |
Hi. I just updated my angular2 project from jspm version 0.16.39 to 0.17.0-beta.22
After updating whenever i try and import a html partial it comes out as "undefined". I am using the meta tag like so
And importing like so
import template from './main.html';
Any help appreciated
The text was updated successfully, but these errors were encountered: