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

Refactor webpack config #358

Open
anjmao opened this issue Sep 15, 2017 · 4 comments
Open

Refactor webpack config #358

anjmao opened this issue Sep 15, 2017 · 4 comments

Comments

@anjmao
Copy link

anjmao commented Sep 15, 2017

Current webpack config is very obscure and confusing. A lot of if(isTest), if(isProd)... and no single responsibility. I suggest to rewrite it using webpack-merge plugin and follow this guide https://webpack.js.org/guides/production/

This will allow to have files:

// all resolves and common plugins registered in common
webpack.common.js

// other builds uses webpack-merge to merge common and extend with custom
webpack.dev.js
webpack.prod.js
webpack.test.js

Example how I use it in my project for prod.

const path = require('path');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.common.js');

module.exports = merge(common, {
  devtool: 'source-map',
  entry: './src/index.js',
  output: {
    filename: 'app.min.js',
    path: path.resolve(__dirname, 'dist')
  },
  plugins: [
    new UglifyJSPlugin({
      sourceMap: true
    })
  ]
});
@Foxandxss
Copy link
Member

I don't mind. I am just not working more on this project since the CLI is way way better.

@GaryB432
Copy link
Contributor

I feel again the impulse to say thanks for this great starter, @Foxandxss . I learned so much, for instance the webpack innards that I miss tweaking a little while I resist the temptation to eject my cli projects. Your work and creativity on this repo is much appreciated!

@Foxandxss
Copy link
Member

Thank you sir. I liked this project and I always wanted to continue it but this last 15 months I was part of the Angular team and I was more and more hooked with the CLI. It has always the latest latest and works really well.

@ollwenjones
Copy link
Contributor

was a huge help to us, too 👍

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