cli icon indicating copy to clipboard operation
cli copied to clipboard

Bundle does not use platform baseDir

Open christophano opened this issue 8 years ago • 5 comments

I'm submitting a bug report

  • Library Version: 0.31.3

Please tell us about your environment:

  • Operating System: OSX 10.12.6

  • Node Version: 7.2.1

  • NPM Version: 4.1.1

  • Browser: all

  • Language: ESNext

  • Loader/bundler: SystemJS

Current behavior: When defining the platform.baseDir property in config the baseDir value is not used.

  • What is the expected behavior? I expected that the cli would use the baseDir as the value to define the base directory in which to write the bundles and find the index file. For example: if I define the baseDir as "wwwroot", the index as "index.html" and the output as "scripts" then I would expect the bundler to write the bundle (e.g. "vendor-bundle.js") to "wwwroot/scripts/vendor-bundle.js" and to update the script src in "wwwroot/index.html" to point to "scripts/vendor-bundle.js".

  • What is the motivation / use case for changing the behavior? For my use case I am using Aurelia served from an aspnet core project, which provides the rest api. I want to be able to keep the client source in a single child folder (named "Client" in my case) and have the cli spit out the bundles into the wwwroot folder.

I have a fix for this, and am happy to submit a PR, but I wanted to first confirm that this is a bug and that I'm not just misunderstanding the intended use case for the baseDir property.

christophano avatar Sep 29 '17 22:09 christophano

@christophano I've added a PR, https://github.com/aurelia/cli/pull/765, that will implement build targets. Do you think it will cover your needs? And if not, what's missing?

jwx avatar Oct 05 '17 12:10 jwx

@jwx that looks like it's 90% of the way there. What I need specifically is to be able to specify the base path for the output (which should support paths outside of the application root) and have the index and output as relative from there. I'm not entirely certain that the target root will cover this?

christophano avatar Oct 06 '17 20:10 christophano

@christophano Target root can be outside of project root ("../sibling-folder-to-project/other-project-root") and target index and output are indeed relative to target root so that shouldn't be a problem at all.

jwx avatar Oct 06 '17 21:10 jwx

I re-read your use case and just setting root: "../wwwroot" should do the trick (provided wwwroot is a sibling folder to Client).

jwx avatar Oct 06 '17 21:10 jwx

That being the case, I'm happy that this PR fixes my issue - thanks!

christophano avatar Oct 08 '17 17:10 christophano