angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Limitations using angular-cli.json instead of webpack.config.js?

Open filipedelmonte opened this issue 10 years ago • 11 comments

Hello, why is the webpack file missing? Was it replace by angular-cli.json? if so, does it imply that there's less flexibility using angular-cli.json then using only the webpack file in case you want to use a custom project structure? I also haven't found any documentation about the angular-cli.json and how it works.

filipedelmonte avatar Oct 26 '16 09:10 filipedelmonte

some config in angular-cli.json can pass to the angular-cli when you exec 'ng serve' or 'ng build', about "apps" in the angular-cli.json. you can clone the code of angular-cli, this section about webpack config can understand with little diffcult .

91Cola avatar Oct 26 '16 10:10 91Cola

I thought the whole point of using angular-cli was so that you could have an opinionated, standardised build setup - with the actual details of it abstracted away from you (with the important thing being consistent and replicable builds, despite the underlying technology).

That aside, perhaps it would be useful to be able to do something similar to create-react-app, and offer an "eject" command to dump all of the build files?

In regards to documentation, that may well be an ongoing effort, as this tool is still in beta.

seeruk avatar Oct 26 '16 17:10 seeruk

I think a webpack config file should be provided which can be imported and merged with the main webpack config file of the cli. Then we can use this webpack file for our custom task for example copying any files other than the assets folder or using fontgen-loader to generate & load icon fonts from svg icons etc.

sabbirrahman avatar Oct 27 '16 06:10 sabbirrahman

Yeah, there should be a webpack config file that we custom to provide more options.

91Cola avatar Oct 27 '16 09:10 91Cola

I agree, I have a build that currently won't support the chunkhash generated by cli's prod build. I have to hack the cli to remove it. However, this is probably a duplicate to #1656 which @hansl closed another issue regarding webpack config and stated this comment as cli's position.

clcarter avatar Oct 27 '16 15:10 clcarter

Aah, that does sound very interesting. An addon system would probably solve the problem. For the time being you could potentially write your own scripts the run alongside angular-cli. The final solution I suppose could be to write your own webpack configuration, as hansl has said in that other issue, if you are at the point where you need to customise your build that much, then you may already be at the point where you're comfortable enough setting up your own build anyway.

seeruk avatar Oct 27 '16 15:10 seeruk

But that's just the rub. It was actually quite easy to change in angular-cli and it's basically the only change I need right now. I'd rather not move away from a rubust scaffold, test and build tool and spend my own time writing a whole custom build or rely on a less well-known/supported starter. So it seems hacking is the way to go right now if you only need a few tweaks. But I agree, I'd love to see the addon system takeoff because I do think it will alleviate/solve this and other problems.

clcarter avatar Oct 27 '16 16:10 clcarter

Well, I've finally had an issue with this. I'm using Handlebars for some on-the-fly, simple templating coming from a web service backend. I've had to hack around getting Handlebars to load without issuing warnings because I can't use the handlebars-loader.

I'd love to make some kind of suggestion about how an add-on system would work, but it'd be a pretty mammoth task. Maybe it's already being thought about?

seeruk avatar Oct 31 '16 22:10 seeruk

I'm going to have to close this one as a dupe of https://github.com/angular/angular-cli/issues/1656. I know the discussion there is closed so you can't discuss there, and that is unfortunate, but on the other hand most of what there is to discuss and be said around this topic has already been said and discussed there.

@t0f3rchr15 you're not the only one wanting to disable the hashing, but I can't say it's a big priority. See https://github.com/angular/angular-cli/issues/2774 for more info.

filipesilva avatar Nov 03 '16 17:11 filipesilva

@filipesilva Can you give us some updates on the progress of the addon system mentioned in #1656? For my project this addon system is crucial if I want to use this awesome CLI.

I really need handlebars in my project. Now I'm not sure if I should start without handlebars and wait for the addon system or not.

Dinistro avatar Jan 12 '17 09:01 Dinistro

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.