Closed sascha-sphw closed 9 years ago
OK. I have just recognized that this error will only appear if i start the app with the following cmd.
activator "~run 9050"
So the ~ is the problem. If I remove the ~ no error will appear, but I got compiled a ts file like
class Main {
constructor() {
console.log("Das ist das Haus vom Nikolaus!");
}
}
new Main();
into an empty javascript file.
Hi @Linowitch,
I'm also using this typescript plugin in a play application, it seems to be working for me, perhaps you can try the following and compare outputs:
➜ mvp git:(typescript) ✗ play plugins
[info] Loading project definition from /Users/pablo/projects/mvp/project
[info] Set current project to mvp (in build file:/Users/pablo/projects/mvp/)
In file:/Users/pablo/projects/mvp/
sbt.plugins.IvyPlugin: enabled in mvp
sbt.plugins.JvmPlugin: enabled in mvp
sbt.plugins.CorePlugin: enabled in mvp
sbt.plugins.JUnitXmlReportPlugin: enabled in mvp
play.Play: enabled in mvp
play.PlayJava
play.PlayScala: enabled in mvp
play.twirl.sbt.SbtTwirl: enabled in mvp
com.typesafe.sbt.jse.SbtJsEngine: enabled in mvp
com.typesafe.sbt.jse.SbtJsTask: enabled in mvp
com.typesafe.sbt.web.SbtWeb: enabled in mvp
com.typesafe.sbt.webdriver.SbtWebDriver: enabled in mvp
com.typesafe.sbt.uglify.SbtUglify: enabled in mvp
net.ground5hark.sbt.concat.SbtConcat: enabled in mvp
com.typesafe.sbt.gzip.SbtGzip: enabled in mvp
com.typesafe.sbt.digest.SbtDigest: enabled in mvp
org.databrary.sbt.angular.templates.AngularTemplates: enabled in mvp
com.arpnetworking.sbt.typescript.SbtTypescript: enabled in mvp
➜ mvp git:(typescript) ✗ cat app/assets/javascripts/example.ts
class Main { constructor() { console.log("Das ist das Haus vom Nikolaus!"); } } new Main();
➜ mvp git:(typescript) ✗ play typescript
[info] Loading project definition from /Users/pablo/projects/mvp/project
[info] Set current project to mvp (in build file:/Users/pablo/projects/mvp/)
[success] Total time: 1 s, completed Feb 19, 2015 1:27:29 PM
➜ mvp git:(typescript) ✗ cat target/web/typescript/main/javascripts/example.js
var Main = (function () {
function Main() {
console.log("Das ist das Haus vom Nikolaus!");
}
return Main;
})();
new Main();
➜ mvp git:(typescript) ✗
Thanks for your help.
My output is almost the same but the js file stays empty.
Is there somewhere a debug log or something else, because I also get no error or warning.
I just set:
logLevel := Level.Debug
On sbt but there's no debug output for the script so no luck there :( I'll create an issue to put that in the todo list.
Did you double check your assets directories and file extensions? You may also wanna check include/exclude filters.
I double checked everything. I build a minimal example. https://github.com/Linowitch/play-typescript
Can't find the error.
The funny part is, that if I do an error in the typescript file I got the information from play. But if I remove the error, nothing gets compiled.
@BrandonArp do you have an idea why I got only empty js files build?
Hey, I'm cloning it right now, will let you know if I found something.
On Fri Feb 20 2015 at 10:03:04 AM Sascha Thiel notifications@github.com wrote:
I double checked everything. I build a minimal example. https://github.com/Linowitch/play-typescript
Can't find the error.
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-75234528 .
Working fine unmodified on my machine:
--- (Running the application, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 4 Scala sources and 2 Java sources to /Users/pablo/projects/playground/linowitch/target/scala-2.11/classes...
[info] TypeScript compiling on 1 source(s)
[info] play - Application started (Dev)
Thanks for testing.
This is weird. I have also tried another machine but same issue.
Could it be that this is a windows issue?
Windows 7 64Bit Java 8 but also tested with 7
hi, i had a lot of problems running play on windows that costs me a lot of time. i think there are problems with long file pathes. now i am using an actual ubuntu installation (in virtualbox) and all my problems are gone. maybe you could give it a try and use a linux based system. best regards
btw: this plugin is awesome :)
You could try virtual box, that would give you a linux installation for testing in no time.
On Fri Feb 20 2015 at 4:28:01 PM legacycode notifications@github.com wrote:
hi, i had a lot of problems running play on windows that costs me a lot of time. i think there are problems with long file pathes. now i am using an actual ubuntu installation and all my problems are gone. maybe you could give it a try and use a linux based system. best regards
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-75303213 .
FWIW I'm working on OSX
On Fri Feb 20 2015 at 5:10:21 PM pablo fernandez fernandezpablo85@gmail.com wrote:
You could try virtual box, that would give you a linux installation for testing in no time.
On Fri Feb 20 2015 at 4:28:01 PM legacycode notifications@github.com wrote:
hi, i had a lot of problems running play on windows that costs me a lot of time. i think there are problems with long file pathes. now i am using an actual ubuntu installation and all my problems are gone. maybe you could give it a try and use a linux based system. best regards
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-75303213 .
I don't mind using a Linux system, but since all this stuff is running in the jvm I think this should be working in windows as well.
Thanks for your help!
i installed node and typescript on windows, created a new play scala project and added a dummy file to it. compiling and running works, but the generated .js files in public folder are zero sized :( on linux it works without any problems. i uploaded my source project to https://github.com/legacycode/PlayFramework-Typescript
you are right. it is working in a jvm and normally it should work on windows as well. in the past i had a lot of problems with external scripts that are triggered, with the .bat file from activator, e.g. i am developing java applications since about 10 years and ever had little problems on windows. that is the reason why most java developer are using a mac or linux based systems.
You may wanna try using node.js as an engine instead of Trirme (see the readme for more details)
On Sun Feb 22 2015 at 4:58:52 AM legacycode notifications@github.com wrote:
i installed node and typescript on windows, created a new play scala project and added a dummy file to it. compiling and running works, but the generated .js files in public folder are zero sized :( on linux it works without any problems. i uploaded my source project to https://github.com/legacycode/PlayFramework-Typescript
you are right. it is working in a jvm and normally it should work on windows as well. in the past i had a lot of problems with external scripts that are triggered, with the .bat file from activator, e.g. i am developing java applications since about 10 years and ever had little problems on windows. that is the reason why most java developer are using a mac or linux based systems.
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-75424636 .
I've encountered the same problem on Mac OSX, so this is not a Windows issue. Any update on this?
have you tried using nodejs as an sbt-js-engine?
On Mon, Mar 9, 2015 at 1:57 PM astorath notifications@github.com wrote:
I've encountered the same problem on Mac OSX, so this is not a Windows issue. Any update on this?
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-77894732 .
Whoa, that's concerning. Was the input file valid? What options were you using? Can you create a project the reproduces the problem? My main development machine is OSX and I haven't seen this problem before. I would really like to get it fixed for you. On Mar 9, 2015 9:57 AM, "astorath" notifications@github.com wrote:
I've encountered the same problem on Mac OSX, so this is not a Windows issue. Any update on this?
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-77894732 .
I'm using node.js
lazy val root = (project in file(".")).enablePlugins(PlayJava, SbtWeb).settings(
JsEngineKeys.engineType := JsEngineKeys.EngineType.Node
)
I also happen to run this plugin on OSX with no problems, if you have a singled out scenario I'd be happy to give it a try.
Note: you don't need to include SbtWeb
as a plugin, PlayJava (or
PlayScala for that matter) does that for you.
On Mon, Mar 9, 2015 at 2:08 PM astorath notifications@github.com wrote:
I'm using node.js
lazy val root = (project in file(".")).enablePlugins(PlayJava, SbtWeb).settings( JsEngineKeys.engineType := JsEngineKeys.EngineType.Node )
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-77897034 .
I can't reproduce the problem with 100% rate - it happens on ~run
command when *.ts
are recompiling. Several page refreshes removes the problem until next time.
Why are you running "~run" ? "run" (no tilde) should be enough. You prepend the tilde when you want a task to re-run every time an sbt source changes. Play handles these automatically so there's no need to execute "~run". Ever. That may be the underlying problem.
On Mon, Mar 9, 2015 at 2:41 PM astorath notifications@github.com wrote:
I can't reproduce the problem with 100% rate - it happens on ~run command when *.ts are recompiling. Several page refreshes removes the problem until next time.
— Reply to this email directly or view it on GitHub https://github.com/ArpNetworking/sbt-typescript/issues/5#issuecomment-77903914 .
@astorath, @Linowitch A lot has changed with the latest release (0.1.5), would you mind running on a Windows box again? Please let me know if the problem has been fixed or still persists. Thanks!
Hi! This issue still not fixed latest release (0.1.5) and would you please check the code below? I cloned a latest source and change the code like this.. then problem fixed.
src/main/resources/typescriptc.js
var sourceFiles = program.getSourceFiles(); logger.debug("got some source files"); sourceFiles.forEach(function (sourceFile) { // \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // window path and linux path not same!!!!! // \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ var comparedFileName = sourceFile.fileName.replace(/\\/g, "/"); var comparedInputFiles = []; for (var i in inputFiles) { comparedInputFiles.push(inputFiles[i].replace(/\\/g, "/")); } var index = comparedInputFiles.indexOf(comparedFileName); if (index === -1) { logger.debug("did not find source file " + sourceFile.fileName + " in list compile list, assuming library or dependency and skipping output"); return; } logger.debug("examining " + sourceFile.fileName); logger.debug("looking for deps"); var depFiles = sourceFile.referencedFiles; var file = sourceFile.fileName; var deps = [sourceFile.fileName]; if (depFiles !== undefined) { logger.debug("got some deps: " + depFiles); depFiles.forEach(function (dep) { logger.debug("found referenced file " + dep.fileName); deps.push(dep.fileName); }); } var result = {source: file, result: {filesRead: deps, filesWritten: [outputFiles[index]]}}; output.results.push(result); }); logger.debug("output=" + JSON.stringify(output)); return output;
Thanks. :-)
+1 this to be fixed. It does not only affect ~run but also dist. I run "dist" and all the generated js files are size 0.
Hey there,
I got the following error. FileNotFoundException: ...AppData\Local\Temp\sbt_29768115\typescript\generatedCompiler.js
I'm using it with play addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")
What do i miss?
Thanks, Sascha