2018-02-26 19:50:13 +00:00
|
|
|
const webpack = require('webpack');
|
2018-09-26 20:14:06 +00:00
|
|
|
const path = require('path');
|
2018-02-26 19:50:13 +00:00
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
|
|
|
|
const cssnext = require('postcss-cssnext');
|
|
|
|
const postcssFocus = require('postcss-focus');
|
|
|
|
const postcssReporter = require('postcss-reporter');
|
|
|
|
const cssnano = require('cssnano');
|
2018-06-15 20:51:42 +00:00
|
|
|
if (process.env.NODE_ENV === "development") {
|
2018-06-07 21:49:17 +00:00
|
|
|
require('dotenv').config();
|
|
|
|
}
|
2016-06-27 22:46:08 +00:00
|
|
|
|
2018-07-30 16:20:57 +00:00
|
|
|
module.exports = [{
|
2017-05-18 21:41:25 +00:00
|
|
|
devtool: 'source-map',
|
2016-06-28 18:41:15 +00:00
|
|
|
|
2016-11-08 23:11:12 +00:00
|
|
|
entry: {
|
|
|
|
app: [
|
2019-06-05 16:05:31 +00:00
|
|
|
'@babel/polyfill',
|
|
|
|
'core-js/modules/es6.promise',
|
|
|
|
'core-js/modules/es6.array.iterator',
|
2018-09-26 20:14:06 +00:00
|
|
|
path.resolve(__dirname, '../client/index.jsx')
|
2016-11-08 23:11:12 +00:00
|
|
|
],
|
|
|
|
vendor: [
|
2016-11-30 18:37:07 +00:00
|
|
|
'axios',
|
|
|
|
'classnames',
|
2018-02-26 19:50:13 +00:00
|
|
|
'codemirror',
|
2016-12-13 22:17:48 +00:00
|
|
|
'csslint',
|
2018-02-26 19:50:13 +00:00
|
|
|
'dropzone',
|
2016-12-13 22:17:48 +00:00
|
|
|
'htmlhint',
|
|
|
|
'js-beautify',
|
2018-02-26 19:50:13 +00:00
|
|
|
'jshint',
|
|
|
|
'react-dom',
|
|
|
|
'react-inlinesvg',
|
|
|
|
'react-redux',
|
|
|
|
'react-router',
|
|
|
|
'react',
|
|
|
|
'redux-form',
|
|
|
|
'redux-thunk',
|
|
|
|
'redux',
|
2016-11-08 23:11:12 +00:00
|
|
|
]
|
|
|
|
},
|
2016-06-27 22:46:08 +00:00
|
|
|
output: {
|
2018-09-26 20:14:06 +00:00
|
|
|
path: path.resolve(__dirname, '../dist/static'),
|
2016-11-08 23:11:12 +00:00
|
|
|
filename: '[name].[chunkhash].js',
|
2018-05-04 20:36:59 +00:00
|
|
|
publicPath: '/'
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
2017-11-06 21:19:43 +00:00
|
|
|
extensions: ['.js', '.jsx'],
|
2016-11-08 23:11:12 +00:00
|
|
|
modules: [
|
|
|
|
'client',
|
|
|
|
'node_modules',
|
|
|
|
]
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2018-10-03 01:03:33 +00:00
|
|
|
rules: [
|
2016-06-27 22:46:08 +00:00
|
|
|
{
|
2018-07-30 16:20:57 +00:00
|
|
|
test: /main\.scss$/,
|
2016-06-27 22:46:08 +00:00
|
|
|
exclude: /node_modules/,
|
2017-11-06 21:19:43 +00:00
|
|
|
loader: ExtractTextPlugin.extract({
|
|
|
|
fallback: 'style-loader',
|
|
|
|
use: 'css-loader!sass-loader!postcss-loader'
|
|
|
|
})
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
2018-10-03 01:03:33 +00:00
|
|
|
use: 'babel-loader'
|
2016-06-27 22:46:08 +00:00
|
|
|
},
|
|
|
|
{
|
2016-08-15 15:51:11 +00:00
|
|
|
test: /\.(svg|mp3)$/,
|
2018-10-03 01:03:33 +00:00
|
|
|
use: 'file-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png)$/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]',
|
|
|
|
outputPath: 'images/'
|
|
|
|
}
|
|
|
|
}
|
2016-08-19 17:13:17 +00:00
|
|
|
},
|
|
|
|
{
|
2018-02-26 19:50:13 +00:00
|
|
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
2018-10-03 01:03:33 +00:00
|
|
|
use: 'file-loader'
|
2018-05-15 19:10:24 +00:00
|
|
|
},
|
|
|
|
{
|
2018-07-30 16:20:57 +00:00
|
|
|
test: /_console-feed.scss/,
|
2018-10-03 01:03:33 +00:00
|
|
|
use: {
|
|
|
|
loader: 'sass-extract-loader',
|
|
|
|
options: {
|
|
|
|
plugins: [{ plugin: 'sass-extract-js', options: { camelCase: false } }]
|
|
|
|
}
|
2018-07-30 16:20:57 +00:00
|
|
|
}
|
2016-06-27 22:46:08 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2018-08-24 21:41:23 +00:00
|
|
|
NODE_ENV: JSON.stringify('production')
|
2016-06-27 22:46:08 +00:00
|
|
|
}
|
|
|
|
}),
|
2016-11-08 23:11:12 +00:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
name: 'vendor',
|
|
|
|
minChunks: Infinity,
|
2018-02-26 19:50:13 +00:00
|
|
|
filename: '[name].[chunkhash].js',
|
2016-11-08 23:11:12 +00:00
|
|
|
}),
|
2017-11-06 21:19:43 +00:00
|
|
|
new ExtractTextPlugin({ filename: 'app.[chunkhash].css', allChunks: true }),
|
2016-11-08 23:11:12 +00:00
|
|
|
new ManifestPlugin({
|
|
|
|
basePath: '/',
|
|
|
|
}),
|
|
|
|
new ChunkManifestPlugin({
|
2018-02-26 19:50:13 +00:00
|
|
|
filename: 'chunk-manifest.json',
|
|
|
|
manifestVariable: 'webpackManifest',
|
2019-01-16 22:56:18 +00:00
|
|
|
inlineManifest: false
|
2016-11-08 23:11:12 +00:00
|
|
|
}),
|
2016-07-22 22:56:54 +00:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
2018-08-09 20:43:51 +00:00
|
|
|
sourceMap: true,
|
2016-10-18 16:59:54 +00:00
|
|
|
compress: {
|
2019-03-14 21:22:17 +00:00
|
|
|
warnings: false,
|
|
|
|
drop_console :true
|
2016-07-22 22:56:54 +00:00
|
|
|
}
|
2017-11-06 21:19:43 +00:00
|
|
|
}),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
options: {
|
|
|
|
postcss: () => [
|
|
|
|
postcssFocus(),
|
|
|
|
cssnext({
|
|
|
|
browsers: ['last 2 versions', 'IE > 9']
|
|
|
|
}),
|
|
|
|
cssnano({
|
|
|
|
autoprefixer: false
|
|
|
|
}),
|
|
|
|
postcssReporter({
|
|
|
|
clearMessages: true
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
2016-07-22 22:56:54 +00:00
|
|
|
})
|
2016-06-28 18:41:15 +00:00
|
|
|
],
|
|
|
|
|
2018-07-30 16:20:57 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
entry: {
|
|
|
|
app: [
|
2018-09-26 20:14:06 +00:00
|
|
|
path.resolve(__dirname, '../client/utils/previewEntry.js')
|
2018-07-30 16:20:57 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
target: 'web',
|
|
|
|
output: {
|
2018-09-26 20:14:06 +00:00
|
|
|
path: path.resolve(__dirname, '../dist/static'),
|
2018-07-30 16:20:57 +00:00
|
|
|
filename: 'previewScripts.js',
|
|
|
|
publicPath: '/'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['*', '.js', '.jsx'],
|
|
|
|
modules: [
|
|
|
|
'client',
|
|
|
|
'node_modules',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
2019-06-05 16:05:31 +00:00
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
babelrc: true
|
|
|
|
}
|
2018-07-30 16:20:57 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
2018-08-20 16:20:41 +00:00
|
|
|
}];
|