2015-06-15 15:21:19 +02:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
|
|
|
var loaders = require('./webpack.loaders');
|
|
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
var WebpackCleanupPlugin = require('webpack-cleanup-plugin');
|
2017-11-07 12:48:01 +01:00
|
|
|
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
2017-11-29 12:29:48 +01:00
|
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
2018-01-05 18:45:55 +01:00
|
|
|
var artifacts = require("../test/artifacts");
|
2018-02-06 11:50:15 +01:00
|
|
|
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
2015-06-15 15:21:19 +02:00
|
|
|
|
2018-01-05 18:45:55 +01:00
|
|
|
var OUTPATH = artifacts.pathSync("/build");
|
2017-07-06 20:53:39 +02:00
|
|
|
|
2015-06-15 15:21:19 +02:00
|
|
|
module.exports = {
|
2016-11-25 13:31:41 +01:00
|
|
|
entry: {
|
|
|
|
app: './src/index.jsx',
|
|
|
|
vendor: [
|
|
|
|
'file-saver',
|
2016-12-28 19:10:27 +01:00
|
|
|
'mapbox-gl/dist/mapbox-gl.js',
|
2016-12-22 18:08:42 +01:00
|
|
|
"lodash.clonedeep",
|
|
|
|
"lodash.throttle",
|
|
|
|
'color',
|
2016-11-25 13:31:41 +01:00
|
|
|
'react',
|
|
|
|
"react-dom",
|
2016-12-20 11:44:22 +01:00
|
|
|
"react-color",
|
2016-11-25 13:31:41 +01:00
|
|
|
"react-file-reader-input",
|
2016-12-22 18:08:42 +01:00
|
|
|
"react-collapse",
|
|
|
|
"react-height",
|
|
|
|
"react-icon-base",
|
|
|
|
"react-motion",
|
|
|
|
"react-sortable-hoc",
|
|
|
|
"request",
|
2016-11-25 13:31:41 +01:00
|
|
|
//TODO: Icons raise multi vendor errors?
|
|
|
|
//"react-icons",
|
|
|
|
]
|
|
|
|
},
|
|
|
|
output: {
|
2017-07-06 20:53:39 +02:00
|
|
|
path: OUTPATH,
|
2016-12-22 18:08:42 +01:00
|
|
|
filename: '[name].[chunkhash].js',
|
|
|
|
chunkFilename: '[chunkhash].js'
|
2016-11-25 13:31:41 +01:00
|
|
|
},
|
|
|
|
resolve: {
|
2017-11-07 12:35:46 +01:00
|
|
|
extensions: ['.js', '.jsx']
|
2016-11-25 13:31:41 +01:00
|
|
|
},
|
|
|
|
module: {
|
2017-11-07 12:35:46 +01:00
|
|
|
noParse: [
|
2018-02-06 11:50:15 +01:00
|
|
|
/mapbox-gl\/dist\/mapbox-gl.js/
|
2017-11-07 12:35:46 +01:00
|
|
|
],
|
2016-12-28 19:10:27 +01:00
|
|
|
loaders
|
2016-11-25 13:31:41 +01:00
|
|
|
},
|
|
|
|
node: {
|
2016-12-19 11:33:13 +01:00
|
|
|
fs: "empty",
|
|
|
|
net: 'empty',
|
|
|
|
tls: 'empty'
|
2016-11-25 13:31:41 +01:00
|
|
|
},
|
|
|
|
plugins: [
|
2017-11-07 12:50:00 +01:00
|
|
|
new webpack.NoEmitOnErrorsPlugin(),
|
2017-11-07 12:35:46 +01:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: '[chunkhash].vendor.js' }),
|
2016-11-25 13:31:41 +01:00
|
|
|
new WebpackCleanupPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
|
|
|
}
|
|
|
|
}),
|
2018-02-06 11:50:15 +01:00
|
|
|
new UglifyJsPlugin(),
|
2016-11-25 13:31:41 +01:00
|
|
|
new ExtractTextPlugin('[contenthash].css', {
|
|
|
|
allChunks: true
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './src/template.html',
|
|
|
|
title: 'Maputnik'
|
|
|
|
}),
|
2017-11-29 12:29:48 +01:00
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{
|
|
|
|
from: './src/manifest.json',
|
|
|
|
to: 'manifest.json'
|
|
|
|
}
|
|
|
|
]),
|
2017-11-07 12:48:01 +01:00
|
|
|
new BundleAnalyzerPlugin({
|
|
|
|
analyzerMode: 'static',
|
|
|
|
defaultSizes: 'gzip',
|
|
|
|
openAnalyzer: false,
|
|
|
|
generateStatsFile: true,
|
|
|
|
reportFilename: 'bundle-stats.html',
|
|
|
|
statsFilename: 'bundle-stats.json',
|
2017-11-07 12:50:00 +01:00
|
|
|
})
|
2016-11-25 13:31:41 +01:00
|
|
|
]
|
2015-06-15 15:21:19 +02:00
|
|
|
};
|