Skip to content

Instantly share code, notes, and snippets.

@vistajess
Created November 26, 2016 18:46
Show Gist options
  • Select an option

  • Save vistajess/7cf451471bd06dc1b636e81eaf15e7d6 to your computer and use it in GitHub Desktop.

Select an option

Save vistajess/7cf451471bd06dc1b636e81eaf15e7d6 to your computer and use it in GitHub Desktop.

Revisions

  1. vistajess created this gist Nov 26, 2016.
    59 changes: 59 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    require('dotenv').config();
    var path = require("path");
    var webpack = require("webpack");
    var stringify = require('stringify-object-values');
    var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');

    var PROD = JSON.parse(process.env.PROD_ENV || '1');
    module.exports = {
    entry: './src/app/app.js',
    output: {
    path: __dirname + '/build/',
    filename: 'script.js'
    },
    module: {
    'ui-bootstrap$': 'angular-bootstrap',
    loaders: [
    {
    test: /\.(js|jsx|es6)$/,
    exclude: /node_modules/,
    loader: 'babel'
    },
    {
    test: /\.html$/,
    loader: "html"
    },
    { test: /\.css$/, loader: "style-loader!css-loader?root=." },
    { test: /\.css$/, exclude: /\.useable\.css$/, loader: "style!css" },
    { test: /\.useable\.css$/, loader: "style/useable!css" },
    {test: /src.*\.js$/, loaders: ['ng-annotate']}
    ]
    },
    htmlLoader: {
    ignoreCustomFragments: [/\{\{.*?}}/]
    },
    resolve: {
    alias: { 'ui-bootstrap$': 'angular-bootstrap' },
    extensions: ['', '.js', '.json', '.jsx', '.es6', '.css', '.html']
    },
    plugins: [
    new webpack.DefinePlugin({ 'process.env': stringify(process.env) }),

    new webpack.optimize.DedupePlugin(),

    new webpack.optimize.UglifyJsPlugin({
    compress: {
    screw_ie8: true,
    warnings: false
    },
    mangle: {
    screw_ie8: true
    },
    output: {
    comments: false,
    screw_ie8: true
    }
    })
    ]

    };