Created
March 22, 2017 17:54
-
-
Save merss19/95292b4336d10b2e6892ab63d6fc8fa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const webpack = require('webpack') | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
const publicPath = '/' | |
module.exports = function() { | |
return { | |
entry: { | |
// 'polyfills': './src/polyfills.ts', | |
// 'vendor': './src/vendor.ts', | |
'main': 'index.js' | |
}, | |
output: { | |
path: path.join(__dirname, '../build'), | |
filename: '[name].bundle.js', | |
publicPath: publicPath, | |
sourceMapFilename: '[name].map' | |
}, | |
resolve: { | |
extensions: ['.js', '.json', 'css'], | |
modules: [path.join(__dirname, '../src'), 'node_modules'] | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'babel-loader', | |
query: { | |
presets: ['env', 'stage-2', 'react', 'es2015', 'babel-preset-react-app'] | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'style-loader', | |
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' | |
] | |
}, | |
{ | |
test: /\.(jpg|png|gif)$/, | |
use: 'file-loader' | |
}, | |
{ | |
test: /\.svg$/, | |
loader: 'svg-inline-loader' | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf|svg)$/, | |
use: { | |
loader: 'url-loader', | |
options: { | |
limit: 100000 | |
} | |
} | |
}] | |
}, | |
plugins: [ | |
/* new webpack.optimize.CommonsChunkPlugin({ | |
name: ['polyfills', 'vendor'].reverse() | |
}),*/ | |
new HtmlWebpackPlugin({ | |
template: 'index.html', | |
chunksSortMode: 'dependency', | |
inject: true, | |
minify: { | |
removeComments: true, | |
collapseWhitespace: true, | |
removeRedundantAttributes: true, | |
useShortDoctype: true, | |
removeEmptyAttributes: true, | |
removeStyleLinkTypeAttributes: true, | |
keepClosingSlash: true, | |
minifyJS: true, | |
minifyCSS: true, | |
minifyURLs: true | |
} | |
}), | |
new webpack.ProvidePlugin({ | |
$: 'jquery', | |
jQuery: 'jquery', | |
'window.jQuery': 'jquery', | |
'signalR': 'assets/js/jquery.signalR.js', | |
'Hub': 'assets/js/chatsHub.js', | |
'lib': 'assets/js/libs.js' | |
}) | |
], | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment