Skip to content
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

VS 2015 Update 3 Clean deletes .js files it shouldn't #10281

Closed
Layoric opened this issue Aug 11, 2016 · 4 comments
Closed

VS 2015 Update 3 Clean deletes .js files it shouldn't #10281

Layoric opened this issue Aug 11, 2016 · 4 comments

Comments

@Layoric
Copy link

Layoric commented Aug 11, 2016

TypeScript Version: 1.8.35

When trying to create an Angular 2 application using JSPM, I could run the application once and then after a Visual Studio rebuild, JSPM could not located Reflect.js from reflect-metadata. It seems that on clean/rebuild action, the Reflect.js file was being deleted.

I believe this is due to Reflect.ts being included in the NPM package and VS/TypeScript matching the two names on clean and deleting the Reflect.js file even though the jspm_packages folder is being excluded in the tsconfig.json. If I change the Reflect.ts file to Reflect_.ts the Reflect.js file is left untouched. This problem also doesn't occur when the package is installed to node_modules via NPM.

Below is my tsconfig.json.

{
  "compileOnSave":  true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "module": "commonjs",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": "node"
  },
  "exclude": [
    "jspm_packages",
    "typings",
    "node_modules",
    "wwwroot"
  ]
}

I've disabled ReSharper in case that was the cause but can still replicate the issue.

Code
I've created a minimal example project with VS 2015 highlighting the issue.

https://github.com/Layoric/VSTypeScriptIssueExampleProject

Running after initial NPM install and VS build should show.

image

Stopping and running a clean/rebuild will run again but not display lower text message and in the web console. Errors will show that JSPM can't find Reflect.js file.

image

Expected behavior:
Visual Studio 2015 adheres to tsconfig.json exclude for both build action as well as clean.
Actual behavior:
When cleaning a project, .js files with matching .ts files that are within directories listed in tsconfig.json exclude array are deleted.

My setup is:
Windows 7
Visual Studio 2015 Update 3
TypeScript 1.8.35
Node 4.2.2
NPM 3.8.3
JSPM 0.16.33 (global)

Let me know if any other info is required 👍

@Layoric
Copy link
Author

Layoric commented Aug 18, 2016

Tested this issue with TypeScript 2.0 beta VS extension and it doesn't occur, so seems this will resolve itself once TS 2.0 is released. 👍

@Layoric Layoric closed this as completed Aug 18, 2016
@oferAshkenazy
Copy link

happing to me VS 2015 angular 2 rc6
have you found any work around?
Thanks

@Layoric
Copy link
Author

Layoric commented Sep 13, 2016

@oferAshkenazy Sadly no, basically work around is to install TypeScript 2.0 beta extension Visual Studio Extension. Direct download link is in the linked blog post.

@BaamAadmi
Copy link

I have a similar issue, where reflect.js file gets edited/checked-out and gives error as
Error: (SystemJS) IsNull is not defined
DecorateConstructor@http://localhost:3000/node_modules/reflect-metadata/Reflect.js:523:44

I use npm and in my tsconfig I added this,
"exclude": [
"node_modules/*"
]
So, Ideally it should not bother any of the files in that area. To workaround this, I had to undo the reflect.js file.

Installed typescript plugin and it is not giving that error so far.

Thanks for your help @Layoric .

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants