Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const webpack = require('webpack');
- const NODE_ENV = 'development';
- // const NODE_ENV = 'production';
- module.exports = {
- context: __dirname + '/frontend',
- entry: {
- home: './home',
- about: './about',
- welcome: './welcome'
- },
- output: {
- path: __dirname + '/public',
- filename: '[name].js',
- library: '[name]'
- },
- devtool: 'source-map',
- watch: NODE_ENV == 'development',
- watchOptions: {
- aggregateTimeout: 300,
- },
- module: {
- loaders: [
- {
- loader: "babel-loader?optional[]=runtime",
- // Only run `.js` and `.jsx` files through Babel
- test: /\.js?$/,
- // Options to configure babel with
- query: {
- plugins: ['transform-runtime'],
- presets: ['es2015'],
- }
- },
- ]
- },
- plugins: [
- new webpack.DefinePlugin({
- NODE_ENV: JSON.stringify(NODE_ENV)
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'common'
- })
- ]
- }
- // PROD
- if (NODE_ENV == 'production') {
- module.exports.plugins.push(
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false,
- drop_console: true,
- unsafe: true
- }
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement