How do I change source directory in Dart/Pub config?

1.3k views Asked by At

I couldn't find answer to this in Dart documentation.

My application's server-side is driven by Spray and by convention static files are stored in /webapp folder. When I try to build Dart project I get following error

C:\work\externals\dart-sdk\bin\pub.bat build --mode=release
Your package must have a "web" directory, or you must specify the source directories.

How can I change it from web to webapp ? My pubspec.yaml looks like this

name:  dart_spray_example
description:  A sample Dart/Spray application

dependencies:
  browser: any

Here is layout of my application right now

enter image description here

1

There are 1 answers

9
Günter Zöchbauer On BEST ANSWER

You just pass it as an additional argument.

pub build --mode=release webapp

but I would expect troubles doing it this way because only some top-level directory names are compliant with the pub package layout convention.

pub build --mode=release example

would be fine.

It might be easier to just use web as the source directory and move the generated output to webapp. I'm aware that this can cause problems during development but I would expect it to be easier to fix the development setup instead of the build setup.

Using frameworks like Angular and Polymer which make heavy use of transformers have a strong dependency on the package layout convention.