2018-02-26 19:50:13 +00:00
|
|
|
const webpack = require('webpack');
|
2018-07-30 16:20:57 +00:00
|
|
|
const path = require('path');
|
2016-07-20 23:48:00 +00:00
|
|
|
require('dotenv').config();
|
2016-05-03 04:09:16 +00:00
|
|
|
|
2018-07-30 16:20:57 +00:00
|
|
|
module.exports = [{
|
2018-02-26 19:50:13 +00:00
|
|
|
devtool: 'cheap-module-eval-source-map',
|
|
|
|
entry: {
|
2018-05-03 00:34:03 +00:00
|
|
|
app: [
|
2018-02-26 19:50:13 +00:00
|
|
|
'webpack-hot-middleware/client',
|
2018-05-03 00:34:03 +00:00
|
|
|
'react-hot-loader/patch',
|
2018-02-26 19:50:13 +00:00
|
|
|
'./client/index.jsx',
|
2016-11-08 23:11:12 +00:00
|
|
|
],
|
|
|
|
vendor: [
|
|
|
|
'react',
|
|
|
|
'react-dom'
|
|
|
|
]
|
|
|
|
},
|
2016-05-03 04:09:16 +00:00
|
|
|
output: {
|
2018-05-04 20:36:59 +00:00
|
|
|
path: `${__dirname}`,
|
2018-02-26 19:50:13 +00:00
|
|
|
filename: 'app.js',
|
2018-05-04 20:36:59 +00:00
|
|
|
publicPath: '/'
|
2016-05-03 04:09:16 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2017-11-06 21:19:43 +00:00
|
|
|
extensions: ['.js', '.jsx'],
|
2016-11-08 23:11:12 +00:00
|
|
|
modules: [
|
|
|
|
'client',
|
2016-11-16 18:12:36 +00:00
|
|
|
'node_modules'
|
2016-11-08 23:11:12 +00:00
|
|
|
]
|
2016-05-03 04:09:16 +00:00
|
|
|
},
|
2018-02-26 19:50:13 +00:00
|
|
|
plugins: [
|
2016-06-22 22:36:04 +00:00
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
2016-11-08 23:11:12 +00:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
name: 'vendor',
|
|
|
|
minChunks: Infinity,
|
|
|
|
filename: 'vendor.js',
|
|
|
|
}),
|
2016-06-22 22:36:04 +00:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2018-02-26 19:50:13 +00:00
|
|
|
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
|
2016-06-22 22:36:04 +00:00
|
|
|
CLIENT: JSON.stringify(true),
|
2017-03-30 16:36:26 +00:00
|
|
|
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
|
|
|
|
JSON.stringify(true) :
|
|
|
|
JSON.stringify(false),
|
2018-02-26 19:50:13 +00:00
|
|
|
NODE_ENV: JSON.stringify('development'),
|
|
|
|
S3_BUCKET: process.env.S3_BUCKET ? `"${process.env.S3_BUCKET}"` : undefined,
|
|
|
|
S3_BUCKET_URL_BASE: process.env.S3_BUCKET_URL_BASE ? `"${process.env.S3_BUCKET_URL_BASE}"` : undefined,
|
|
|
|
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
|
2016-06-22 22:36:04 +00:00
|
|
|
}
|
|
|
|
})
|
2016-05-03 04:09:16 +00:00
|
|
|
],
|
|
|
|
module: {
|
2018-05-03 00:34:03 +00:00
|
|
|
rules: [
|
2016-05-03 04:09:16 +00:00
|
|
|
{
|
2016-06-27 21:40:16 +00:00
|
|
|
test: /\.jsx?$/,
|
2016-05-03 04:09:16 +00:00
|
|
|
exclude: [/node_modules/, /.+\.config.js/],
|
2018-05-03 00:34:03 +00:00
|
|
|
use: [{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
cacheDirectory: true,
|
|
|
|
plugins: ['react-hot-loader/babel'],
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
loader: 'eslint-loader'
|
|
|
|
}]
|
2018-05-09 00:57:16 +00:00
|
|
|
// use: {
|
|
|
|
// loader: 'babel-loader',
|
|
|
|
// options: {
|
|
|
|
// cacheDirectory: true,
|
|
|
|
// plugins: ['react-hot-loader/babel'],
|
|
|
|
// }
|
|
|
|
// }
|
2016-05-03 04:09:16 +00:00
|
|
|
},
|
2016-05-03 20:13:04 +00:00
|
|
|
{
|
2018-07-30 16:20:57 +00:00
|
|
|
test: /main\.scss$/,
|
2017-11-06 21:19:43 +00:00
|
|
|
loaders: ['style-loader', 'css-loader', 'sass-loader']
|
2016-05-11 17:19:37 +00:00
|
|
|
},
|
|
|
|
{
|
2016-08-15 15:51:11 +00:00
|
|
|
test: /\.(svg|mp3)$/,
|
2017-11-06 21:19:43 +00:00
|
|
|
loader: 'file-loader'
|
2016-08-18 18:22:47 +00:00
|
|
|
},
|
|
|
|
{
|
2018-02-26 19:50:13 +00:00
|
|
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
|
|
|
loader: 'file-loader'
|
2018-05-15 19:10:24 +00:00
|
|
|
},
|
|
|
|
{
|
2018-07-30 16:20:57 +00:00
|
|
|
test: /_console-feed.scss/,
|
|
|
|
loader: 'sass-extract-loader',
|
|
|
|
options: {
|
|
|
|
plugins: [{ plugin: 'sass-extract-js', options: { camelCase: false } }]
|
|
|
|
}
|
2016-05-03 20:13:04 +00:00
|
|
|
}
|
2016-05-03 04:09:16 +00:00
|
|
|
],
|
|
|
|
},
|
2018-07-30 16:20:57 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
entry: path.resolve(__dirname, 'client/utils/previewEntry.js'),
|
|
|
|
target: 'web',
|
|
|
|
output: {
|
|
|
|
path: `${__dirname}`,
|
|
|
|
filename: 'previewScripts.js',
|
|
|
|
publicPath: '/'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['*', '.js', '.jsx'],
|
|
|
|
modules: [
|
|
|
|
'client',
|
|
|
|
'node_modules',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
query: {
|
|
|
|
presets: [
|
|
|
|
'react',
|
|
|
|
'env',
|
|
|
|
'stage-0',
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
[
|
|
|
|
'babel-plugin-webpack-loaders', {
|
|
|
|
'config': './webpack.config.babel.js',
|
|
|
|
"verbose": false
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}]
|