Skip to content

Commit

Permalink
[chore] webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
romelperez committed Nov 17, 2016
1 parent 48260b3 commit 06c97d2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
24 changes: 24 additions & 0 deletions webpack.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require('path');

const srcPath = path.join(process.cwd(), '/src');

module.exports = {
resolve: {
fallback: srcPath
},
module: {
loaders: [{
loader: 'babel',
test: /\.js$/,
include: srcPath,
exclude: /(node_modules|bower_components|static_components)/,
query: {
presets: [
'react',
'es2015',
'stage-1'
]
}
}]
}
};
38 changes: 38 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const webpack = require('webpack');
const webpackBase = require('./webpack.base.js');
const log = require(process.cwd() + '/src/server/log');

log.app.env();

const dev = process.env.NODE_ENV !== 'production';
const plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(
dev ? 'development' : 'production'
)
})
];

if (!dev) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
})
);
}

module.exports = Object.assign({}, webpackBase, {
entry: {
'core': './src/client/core/index.js',
'home': './src/client/home/index.js',
'app': './src/client/app/index.js',
'login': './src/client/login/index.js',
'register': './src/client/register/index.js',
},
output: {
path: './public/js/',
filename: '[name].js'
},
devtool: dev ? 'inline-source-map' : undefined,
plugins
});

0 comments on commit 06c97d2

Please sign in to comment.