1

I installed dart-sdk and downloaded dart plugin to Phpstorm 8.0.3, but I cant figure out how to transpile dart to js. When I am trying to make file watcher I dont have any Dart2Js predefined template in settings.

Thank you

2

2 Answers 2

3

I know only WebStorm 9 and 10. Maybe you can still derive how it might work in PHPStorm.

Usually you don't want to build to JavaScript on each file change because this would slow your machine down.
During development you use pub serve which is automatically launched by WS 9 and 10 and which transpiles Dart files to JavaScript only on demand (when requested by a browser) and only compiles what it didn't compile previously.

For deployment WebStorm can use the Pub: build ... context menu of the pubspec.yaml file in the project view.

Sign up to request clarification or add additional context in comments.

1 Comment

I've used both PHPStorm and WebStorm for Dart development, and there is really no difference at all (aside from minor changes to the IDE itself since they aren't on identical update schedules). Everything Günter said about WebStorm is true for PHPStorm as well.
2

See @Günter Zöchbauer answer. Using dart2js is not the recommended approach, as it runs on file level instead of project, creates output in the src folder, etc. - but the main reason is that it is not clear when/why to use it. If you need to build your project, use 'pub build' (available in pubspec.yaml right-click menu). When debugging in browser, 'pub serve' is always used implicitly - it performs all needed transformations... But, if you still need this watcher, you can easily configure it yourself by adding a watcher of 'custom' type.

Program: path/to/dart2js
Arguments: --out=$FilePath$.js $FilePath$
Working directory: $FileDir$
Output paths: $FileName$.js:$FileName$.js.map:$FileName$.js.deps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.