Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable support for extending Webpack config #88

Closed
lucidlemon opened this issue Apr 10, 2018 · 4 comments
Closed

Enable support for extending Webpack config #88

lucidlemon opened this issue Apr 10, 2018 · 4 comments
Milestone

Comments

@lucidlemon
Copy link

The Problem
Right now we have 2 options to use the cli-build:

  • either take the config as is, 100%
  • eject the whole config and support later changes on our own.

The Goal
Using the Default config but extending small options with our own Webpack config object

Advantages
You could specify small things such as additional loaders, other postCSS Settings etc without ejecting the while project. If you just want to fine-tune a few objects there is no need to extract the full configuration.

The Solution
There is already a package that pretty much does exactly what I would want to do. Could this be implemented? Would solve a lot of pain in the... escape key.

@tomdye
Copy link
Member

tomdye commented Apr 10, 2018

The cli build tool was built with the goal of providing a config free approach to building a dojo 2 application with opinionated defaults. The tradeoff here is that the webpack.config we have created is not always a one size fits all approach.

We provide the eject command along with the webpack-contrib repo which will allow you to edit and support your own webpack.config. We have no plans to offer webpack level customisations as the cli is a deliberate abstraction above this.

If you feel that there is something missing from the webpack.config that the build app command uses then please raise an issue to discuss adding it in so that we can improve the provided config for every user. This is still a work in progress.

@lucidlemon
Copy link
Author

I would not want to eject my full config just because I hate to type in rgba colors in css as rgba, I want to use rgba(#06789f, 0.4) to get this color with 40% opacity, because noone uses colors in rgb. But that tiny tiny tiny tiny tiny function, which would just require a require('postcss-hexrgba') to work, can't be done because I would have to eject the full project.

I don't want to have a simple icon in 5 different colors to manage when I can just use

@svg-load nav url(img/nav.svg) {
    fill: #cfc;
    path:nth-child(2) {
        fill: #ff0;
    }
}
.nav {
    background: svg-inline(nav);
}
.up {
    background: svg-load('img/arrow-up.svg', fill=#000, stroke=#fff);
}

to have the icon in 2 colors.

Maybe I want to test my site for accessibility with postcss-colorblind.

Maybe I don't care to search for various postcss and I just want to use that one package that makes postcss actually usable.

Maybe I use a CSS Framework like bootstrap as a basis, but I can't use it since there isn't even a default SCSS or less loader. And it's not like importing less via less-loader would be so ground breaking that your whole project will explode if you use it.

Maybe I want all the loaders as they are in dojo, but images below 8096 bytes should get automatically pulled in as base64.


Opinionated is nice and stuff. But a minimum level of customization would not hurt. If you don't want any customization you should disable changing the tslint config as well. Hell.. even the package.json allows customization, maybe we should lock that down too? Even prettier, the opinionated linter, allows me to choose between trailing comma or not.

@matt-gadd
Copy link
Contributor

matt-gadd commented Apr 10, 2018

I'm not sure what you mean about the package.json or tslint.config, they are both external to the cli-build command. Prettier is a super bad example as it is totally opinionated and offers little customisation itself.

As @tomdye hinted, we have no plans to open up webpack specific parts of the config - the entire project is meant to be an abstraction upon that and there is no guarantee in the future that the implementation will even be webpack. To add to that merging webpack configs is totally fraught with issues, from ordering to flattening (I'd like to think we are talking from reasonable experiences as we used the package you listed internally for configs while POC'ing the original cli-build-webpack command). Webpack configs generally do not compose well or at least to the level we'd ever consider supporting.

We are definitely open to small pieces of abstract customization such as potentially offering postcss plugin support (which are not webpack specific), if you raise an issue specific to that we can likely better discuss what that may look like.

Again just to reiterate, there are 3 escape hatch's if that doesn't suffice:

  • eject the config, you then get full control and you are now just dealing with webpack
  • fork the cli-build-app command, you can then modify your configs as you wish while still being able to pull in potential updates from upstream. the cli fully supports non-official user authored commands.
  • compose your own webpack config by using parts of webpack-contrib

@lucidlemon
Copy link
Author

okay so in other words the cli-build-app config is useless. understood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants