Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

dart

dart-pub

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

like image 564
expert Avatar asked Dec 03 '25 09:12

expert


1 Answers

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.

like image 61
Günter Zöchbauer Avatar answered Dec 05 '25 00:12

Günter Zöchbauer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!