2018-12-21 22:18:05 +03:00
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
|
|
|
|
|
|
|
var isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
devtool: 'source-map',
|
|
|
|
entry: [
|
|
|
|
!isProduction && 'webpack-dev-server/client?http://localhost:3000',
|
|
|
|
!isProduction && 'webpack/hot/only-dev-server',
|
|
|
|
'./src/index'
|
|
|
|
].filter(Boolean),
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: 'bundle.js',
|
|
|
|
publicPath: '/static/'
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.NoEmitOnErrorsPlugin(),
|
2019-01-10 21:51:14 +03:00
|
|
|
isProduction &&
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: { warnings: false },
|
|
|
|
output: { comments: false },
|
|
|
|
sourceMap: true
|
|
|
|
})
|
2018-12-21 22:18:05 +03:00
|
|
|
].filter(Boolean),
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'react-json-tree/lib': path.join(__dirname, '..', 'src'),
|
|
|
|
'react-json-tree': path.join(__dirname, '..', 'src'),
|
2019-01-10 21:51:14 +03:00
|
|
|
react: path.join(__dirname, 'node_modules', 'react')
|
2018-12-21 22:18:05 +03:00
|
|
|
},
|
|
|
|
extensions: ['.js']
|
|
|
|
},
|
|
|
|
module: {
|
2019-01-10 21:51:14 +03:00
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loaders: ['babel-loader'].filter(Boolean),
|
|
|
|
include: path.join(__dirname, 'src')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loaders: ['babel-loader'].filter(Boolean),
|
|
|
|
include: path.join(__dirname, '..', 'src')
|
|
|
|
}
|
|
|
|
]
|
2018-12-21 22:18:05 +03:00
|
|
|
}
|
|
|
|
};
|