This package provides an opportunity to modify @angular/cli project's webpack configuration without "ejecting".
- Installation
npm i ngw -D - Setting up
Run in cli project root (where package.json is)
node_modules/.bin/ngw --set-up
Last command makes two things:
- Changes scripts in package.json that starts from
ngtongw - Creates file
ngw.config.tsin project root where you can redefinewebpack.Configurationused by@angular/cli
You may like to do npm i -D @types/webpack for better experience.
This little piece of code in your ngw.config removes unused selectors from your CSS:
export default function(config: webpack.Configuration) {
config.plugins.push(
new PurifyCSSPlugin({
paths: glob.sync(path.join(__dirname, '**/*.html'))
})
);
return config;
}For complex cases it's more appropriate to use ng eject command. Default building process could be changed significanlty in further @angular/cli releases so your customization could break (or became broken).
- Common recepies
- Ability to write/publish recepies
- Isolated webpack changes
- Separate Dev and Prod configs