-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to load global script? #213
Comments
Repro: https://github.com/unional/domture/tree/global-script-with-type It uses |
Here is the systemjs config being used: {
"baseURL": "node_modules",
"packageConfigPaths": [
"@*/*/package.json",
"*/package.json"
],
"map": {
"app": "./fixtures/ts"
},
"packages": {
"app": {
"defaultExtension": "ts"
},
"typescript": {
"main": "lib/typescript.js",
"meta": {
"lib/typescript.js": {
"exports": "ts"
}
}
},
"plugin-typescript": {
"main": "lib/plugin.js"
}
},
"transpiler": "plugin-typescript"
} |
Seems like even when loading global ts files without typed information also have some quirks. I don't have a repro on this one because it is related to my work, but in essence, it throws a // source.ts
TestClass = Ext.extends(BaseClass, { ... })
// test.ts
console.log(TestClass)
const instance = new TestClass({}) // TypeError: TestClass is not a constructor If I load the source from transpiled js, it is working, but if I load The { [Function: constructor]
superclass:
constructor {
constructor:
{ [Function: constructor]
superclass: [Object],
override: [Function],
extend: [Function],
xtype: 'store',
Error: [Object] },
supr: [Function],
superclass: [Function],
override: [Function: io],
writer: undefined,
... |
Looking at the first issue it seems that the file is not getting passed through the transpiler, I'm not exactly sure why, but it's likely to be a configuration issue. |
Thanks Frank. I try to change some config as you suggest and now this one works: {
"baseURL": "node_modules",
"packageConfigPaths": [
"@*/*/package.json",
"*/package.json"
],
"map": {
"app": "./fixtures/ts"
},
"packages": {
"app": {
"defaultExtension": "ts",
"meta": {
"*.ts": {
"loader": "plugin-typescript"
}
}
},
"typescript": {
"main": "lib/typescript.js",
"meta": {
"lib/typescript.js": {
"exports": "ts"
}
}
},
"plugin-typescript": {
"main": "lib/plugin.js"
}
},
"transpiler": "plugin-typescript"
} But I thought the I'll continue to see if the second issue is also resolved. |
YES! that also solves the second issue. Now the remaining question is why it doesn't work without the |
I tried to load a file like this and failed:
error: 'Missing initializer in const declaration'.
If I remove the type, i.e. from
const foo: string = 'foo'
toconst foo = 'foo'
, it works.The text was updated successfully, but these errors were encountered: