p5.js-web-editor/webpack.config.prod.js

115 lines
2.4 KiB
JavaScript
Raw Normal View History

2016-06-28 00:46:08 +02:00
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ManifestPlugin = require('webpack-manifest-plugin');
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
2016-06-28 20:41:15 +02:00
var cssnext = require('postcss-cssnext');
var postcssFocus = require('postcss-focus');
var postcssReporter = require('postcss-reporter');
var cssnano = require('cssnano');
2016-07-21 02:59:37 +02:00
require('dotenv').config();
2016-06-28 00:46:08 +02:00
module.exports = {
2016-06-28 20:41:15 +02:00
devtool: 'hidden-source-map',
entry: {
app: [
'babel-polyfill',
'./client/index.jsx'
],
vendor: [
'react',
2016-11-30 19:37:07 +01:00
'react-dom',
'redux',
'codemirror',
'moment',
'redux-form',
'react-redux',
'dropzone',
'axios',
'classnames',
'react-inlinesvg',
'react-router',
2016-12-13 23:17:48 +01:00
'redux-thunk',
'csslint',
'jshint',
'htmlhint',
'js-beautify',
]
},
2016-06-28 00:46:08 +02:00
output: {
2016-06-28 20:41:15 +02:00
path: __dirname + '/static/dist',
filename: '[name].[chunkhash].js',
2016-06-28 00:46:08 +02:00
publicPath: '/dist/'
},
resolve: {
extensions: ['', '.js', '.jsx'],
modules: [
'client',
'node_modules',
]
2016-06-28 00:46:08 +02:00
},
module: {
loaders: [
{
test: /\.scss$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract('style', 'css!sass!postcss')
2016-06-28 00:46:08 +02:00
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.(svg|mp3)$/,
2016-06-28 00:46:08 +02:00
loader: 'file'
2016-08-19 19:13:17 +02:00
},
{
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file'
2016-06-28 00:46:08 +02:00
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
'S3_BUCKET': '"' + process.env.S3_BUCKET + '"'
2016-06-28 00:46:08 +02:00
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.js',
}),
new ExtractTextPlugin('app.[chunkhash].css', { allChunks: true }),
new ManifestPlugin({
basePath: '/',
}),
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest",
}),
2016-07-23 00:56:54 +02:00
new webpack.optimize.UglifyJsPlugin({
2016-10-18 18:59:54 +02:00
compress: {
2016-07-23 00:56:54 +02:00
warnings: false
}
})
2016-06-28 20:41:15 +02:00
],
postcss: () => [
postcssFocus(),
cssnext({
browsers: ['last 2 versions', 'IE > 9']
}),
cssnano({
autoprefixer: false
}),
postcssReporter({
clearMessages: true
})
2016-06-28 00:46:08 +02:00
]
};