Reputation: 640
Angular2 has moved to a more modular approach to a projects sources. That means that all of a submodules sources, html templates and tests are together in one directory. Instead of spread across an app, public and test directory.
It's an approach that makes a lot of sense.
I'm trying to configure Play/sbt-web for that. I have the following settings in my project:
includeFilter in Assets in typescript:= GlobFilter("*.ts") | GlobFilter("*.tsx")
excludeFilter in Assets in typescript:= GlobFilter("*.spec.ts") | GlobFilter("*.mock.ts")
sourceDirectory in TestAssets := (sourceDirectory in Assets).value
includeFilter in TestAssets in typescript := GlobFilter("*.spec.ts") | GlobFilter("*.mock.ts")
excludeFilter in TestAssets in typescript := - (GlobFilter("*.spec.ts") | GlobFilter("*.mock.ts"))
The asset compilation steps work correctly. But afterwards I get a duplicate mappings error (see below). It seems that the compiled Assets are added as a webjar dependency to the TestAssets compilation without applying the excludefilter. Which would explain the duplicatemappings.
Is there a way to get this to work in my project? Or is this a shortcoming in sbt-web? (I'm willing to work on a pullrequest for a fix if necessary)
you can find my Activator example play-angular2-typescript project here.
This is the duplicate mapping error:
[error] (web-assets-test:assets) Duplicate mappings:
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/public/test/public/app/app.ts
[error] from
[error] /Users/joost1/source/play-angular2-typescript-template/app/assets/app/app.ts
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/web-modules/test/webjars/lib/play-angular2-typescript/app/app.ts
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/public/test/public/app/app.html
[error] from
[error] /Users/joost1/source/play-angular2-typescript-template/app/assets/app/app.html
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/web-modules/test/webjars/lib/play-angular2-typescript/app/app.html
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/public/test/public/app/app.spec.ts
[error] from
[error] /Users/joost1/source/play-angular2-typescript-template/app/assets/app/app.spec.ts
[error] /Users/joost1/source/play-angular2-typescript-template/target/web/web-modules/test/webjars/lib/play-angular2-typescript/app/app.spec.ts
Upvotes: 2
Views: 125