Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var glob = require('glob'),
- ngAnnotate = require('ng-annotate-webpack-plugin'),
- ExtractTextPlugin = require('extract-text-webpack-plugin'),
- webpack = require('webpack');
- const prod = process.argv.indexOf('-p') !== -1;
- var plugins = [
- new ngAnnotate({
- add: true,
- }),
- new ExtractTextPlugin('bundle.css'),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'profile',
- children: true,
- minChunks: 2,
- async: true
- }),
- ];
- if (prod) {
- plugins.push(
- new webpack.NoEmitOnErrorsPlugin(),
- new webpack.optimize.UglifyJsPlugin({
- beautify: false,
- comments: false,
- compress: {
- sequences: true,
- booleans: true,
- loops: true,
- unused: true,
- warnings: false,
- drop_console: true,
- unsafe: true
- }
- })
- );
- }
- module.exports = {
- entry: {
- bundle: __dirname + '/application/application.js',
- profile: __dirname + '/application/modules/profile.module.js'
- },
- output: {
- path: __dirname + '/build',
- filename: '[name].js'
- },
- plugins: plugins,
- resolve: {
- alias: {
- moment: __dirname + '/node_modules/moment/min/moment'
- },
- },
- module: {
- loaders: [
- {
- test: /\.js$/,
- loader: 'babel-loader',
- query: {
- presets: ['babel-preset-es2015'].map(require.resolve)
- },
- exclude: /(node_modules|bower_components)/
- },
- {
- test: /\.(png|woff|woff2|eot|ttf|svg|gif|jpg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
- loader: 'url-loader',
- options: {
- limit: 1
- }
- },
- {
- test: /\.css$/,
- loader: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: 'css-loader'
- })
- }
- ]
- },
- node: {
- fs: 'empty'
- },
- devServer: {
- historyApiFallback: true
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement