-
Notifications
You must be signed in to change notification settings - Fork 236
cannot import modules #207
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
Comments
To specify options for the editor that you would normally specify on the command-line for the compiler, add a tsconfig.json file to the directory (or a parent directory) of your code. The Sublime plugin for TypeScript will use the settings in this file. See https://github.com/Microsoft/TypeScript/wiki/tsconfig.json |
Oh. Thanks :) Do you think it's a welcomed PR if I make this more visible in the readme of the ST plugin? |
@billti, I'm still getting that error even with the file, but only when editing files that are 2 or more folders deep. It seems as though the plugin is only looking in the file's current folder and the one above that. There are no errors when compiling the project, but Sublime has red squiggles in almost every file. |
my typescript compiler even does not lookup Build output:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true
},
"files": [
"typings/tsd.d.ts"
]
} From terminal:
|
I also had problems with this plugin working for files that were deeply nested in the directory structure. I use webpack and had originally set the tsconfig files to 2 files: my entry point and my typings file. With this configuration, sublime showed red squiggles everywhere and the typescript auto completion feature did not work. Somewhere, I recalled a user reporting that this plugin worked as expected if every ts file in his project was listed in the tsconfig files array (and he suggested using gulp to keep this in sync). Sure enough, listing each ts file in the tsconfig files array works - the red squiggles no longer appear and auto completion also works. The ArcticTypescript package describes a filesGlob property that can use wildcards. I replaced the files property with filesGlob as they describe and boom - everything started working for all my files without the need for a gulp workflow to update this automatically. {
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"removeComments": false,
"target": "es5"
},
"filesGlob": [
"./**/*.ts",
"!./node_modules/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
} |
@ulritech |
@summerwish This is because your To solve the issue, as @ulritech suggested above try to add all source files of your project in your |
There is an open PR for the filesGlob support (microsoft/TypeScript#5980), though it is not merged in yet. The one came with |
That's weird - How my config works then?
|
It probably is a coincident. Assuming you are not using the |
Got it. So for now, until filesGlob is supported, I should include all files I want to compile in the files array? |
You can, though you definitely can do without the files array and implicitly include every ts files in the folder, and put stuff you don't want in the exclude array, if that works for you. Zhengbo From: Bar Ziony [email protected] Got it. So for now, until filesGlob is supported, I should include all files I want to compile in the files array? Reply to this email directly or view it on GitHubhttps://github.com//issues/207#issuecomment-170844084. |
If i use the
-m commonjs
option from cli then I can do this in the code:but in ST the plugin marks the line as an error saying:
how do I provide command line options to the plugin?
The text was updated successfully, but these errors were encountered: