Dart2JS cannot find WebStorm import packages
I am using WebStorm 8 IDE to create a web darter application. I have the following directory structure:
root
web
main.dart
lib
packages
browser
intl
intl.dart
pubspec.lock
pubspec.yaml
Q main.dart
I have the following import status:import "package:intl/intl.dart";
However, when I try to compile main.dart
to javascript, I get the following error:
dart2js
Error occurred:
/Path/To/Project/root/web/main.dart:2:8:
Error: Can't read 'package:intl/intl.dart' (Error reading '/Path/To/Project/root/web/packages/intl/intl.dart' (OS Error: No such file or directory, errno = 2)).
import "package:../packages/intl/intl.dart";
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Compilation failed.
So it seems that dart2js is looking at the current directory of the dart file to be converted for packages, which is not correct.
I tried to change my import statement to import "package:../packages/intl/intl.dart";
, but I got the same error.
Does anyone have any ideas?
UPDATE:
I can use pub build
to build my project and build main.dart.js
. Not sure what happens when I call the assembly, maybe there is something wrong with the WebStorm?
source to share