Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const typescript = require('@webpack-blocks/typescript');
- const {addPlugins, createConfig, customConfig, entryPoint, defineConstants, env, setOutput, sourceMaps} =
- require('@webpack-blocks/webpack2');
- const webpack = require('webpack');
- const LiveReloadPlugin = require('webpack-livereload-plugin');
- const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
- const NODE_ENV = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
- const postcss = require('@webpack-blocks/postcss');
- const sass = require('@webpack-blocks/sass');
- const autoprefixer = require('autoprefixer');
- const extractText = require('@webpack-blocks/extract-text2');
- const tslint = require('@webpack-blocks/tslint');
- module.exports = createConfig([
- entryPoint({
- 'customer-support': './ClientApp/index.tsx',
- 'my-posts-chat': './ClientApp/Routes/MyPosts/index.tsx',
- // 'chat': './ClientApp/Components/Chat/Chat.tsx',
- }),
- setOutput({
- path: __dirname + '/wwwroot',
- filename: '[name].bundle.js',
- sourceMapFilename: '[name].map',
- chunkFilename: '[id].chunk.js'
- }),
- defineConstants({
- 'process.env.NODE_ENV': `${NODE_ENV}`,
- 'DEBUG': NODE_ENV === 'development',
- 'PRODUCTION': NODE_ENV === 'production'
- }),
- typescript(),
- tslint(),
- sass(),
- postcss([
- autoprefixer({browsers: ['last 4 versions']})
- ]),
- customConfig({
- externals: {
- 'moment': 'moment',
- }
- }),
- addPlugins([
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- minChunks: function (module) {
- const context = module.context;
- return context && context.indexOf('node_modules') >= 0;
- },
- }),
- ]),
- env('development', [
- // will only enable source maps if `NODE_ENV === 'development'`
- sourceMaps('cheap-module-eval-source-map'),
- addPlugins([
- new LiveReloadPlugin({}),
- new WebpackBuildNotifierPlugin({
- title: 'Billy3 Frontend Build',
- suppressSuccess: true
- })
- ])
- ]),
- env('production', [
- sourceMaps('source-map'),
- extractText('[name].css', 'text/x-sass'),
- addPlugins([
- new webpack.optimize.UglifyJsPlugin({
- beautify: false,
- sourceMap: true,
- comments: false,
- mangle: {
- screw_ie8: true,
- keep_fnames: true
- },
- compress: {
- screw_ie8: true,
- warnings: false
- },
- }),
- ])
- ])
- ]);
Advertisement
Add Comment
Please, Sign In to add comment