Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var path = require('path');
- var HtmlWebpackPlugin = require('html-webpack-plugin');
- var glob = require('glob');
- var webpack = require('webpack');
- var PROD = (process.env.NODE_ENV === 'production')
- module.exports = {
- devtool: PROD ? 'cheap-module-source-map' : 'source-map',
- context: path.resolve(__dirname, 'src'),
- entry: {
- vendor: ['es5-shim', 'es6-shim','angular', 'angular-ui-bootstrap',
- 'angular-ui-router', 'ngstorage'
- ],
- css: ['./client/main.less'],
- index: ['./client/main.ts'].concat(glob.sync('./client/**/*.ts', {cwd: './src'}))
- },
- output: {
- path: path.join(__dirname, 'public'),
- filename: 'lib/[name].[chunkhash].' + (PROD ? 'bundle.min.js' : 'bundle.js')
- },
- resolve: {
- extensions: ['', '.ts', '.js']
- },
- module: {
- loaders: [
- {
- test: /\.less$/,
- loaders: ['style-loader', 'css-loader', 'less-loader']
- },
- {
- test: /\.ts$/,
- loaders: ['ng-annotate', 'ts'],
- exclude: /node_modules/
- },
- {
- test: /\.html$/,
- loader: 'ngtemplate?relativeTo=/src/client/!html',
- exclude: /index\.html/
- },
- {
- test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
- loader: 'url-loader?limit=30000&name=fonts/[name]-[hash].[ext]'
- }
- ],
- },
- plugins: [
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor'
- }),
- // new webpack.optimize.CommonsChunkPlugin('css'),
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: './client/index.html'
- })
- ].concat(PROD ? [
- new webpack.optimize.UglifyJsPlugin({
- compress: {warnings: false}
- })
- ] : [])
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement