aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

Bundling outputs dist/app-bundle.js in config.js #82

Closed damianof closed 8 years ago

damianof commented 8 years ago

After bundling, I have to go manually remove the prefix dist/ and the .js extension from the bundles path in config.js from this: bundles: { "dist/app-build.js": [ ...

to this: bundles: { "app-build": [ ...

StrahilKazlachev commented 8 years ago

It's not a prefix, it' the path to the bundle that is provided to the bundler(where is generated). But it would be nice if we can provide what path to be injected in the config(path different from that where the bundle is generated). My case: maven build process, all generated files go in the target folder, and in the pom.xml I have configuration what to include to the resources of the bundle(.jar). So what I get injected in the config.js is where the files are generated, not where they will actually be. So I have made a task to modify the config.js bundles section.

ahmedshuhel commented 8 years ago

@damianof @StrahilKazlachev You should not need to do that. Bundler can automatically figure out what the injection bundle name from the output file/path. If the baseURL, config.js paths are correctly configured, it should just work. We need more info on this.

Better if you can point me to a Github Repo that reproduces the problem predictably. Are you using the latest version (v 0.3.2) with the latest version of SystemJS?

StrahilKazlachev commented 8 years ago
├── myProj/
│   ├── pom.xml
│   ├── gulp.js
│   ├── package.json
│   ├── target
│   ├── jspm_packages
│   ├── node_modules
│   ├── src
│   │   ├── main
│   │   │   ├── java
│   │   │   ├── webapp
│   │   │   │   ├── config.js
│   │   │   │   ├── other app files/folders

This is my project structure, the sources are in ./src/main/webapp. But all generated files have to go in ./target/...(can not use other folder) and from there are packaged in the .jar. baseURL is myProj/ because I need ./target in my baseURL. But afterwards when the .jar is build it has this structure:

├── resources/
│   ├── res
│   │   ├── app
│   │   ├── vendors
│   │   ├── config.js

So I use one baseURL build time and other runtime. That's why I'm modifying config.js. Suggestions and criticism are welcomed.

ahmedshuhel commented 8 years ago

This is more of a project structure issue. Is there any thing we can do to ease the pain of manually editing the injection name in config.js in scenarios like this?

Perhaps, the bundler may always use a specific injection name supplied via config,js that overrides the bundle name generation internally.

Raise an separate issue (close this one) if you think the above can solve/ease the problem.

damianof commented 8 years ago

I'm puzzled as I see many people using jQuery with Aurelia. Am I the only one having this issue?

EisenbergEffect commented 8 years ago

Closing this issue as it's not a bug in bundling but a config issue that was addressed.