2015-06-15 15:21:19 +02:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
2018-10-09 21:43:35 +02:00
|
|
|
var rules = require('./webpack.rules');
|
2015-06-15 15:21:19 +02:00
|
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
2020-02-17 20:03:19 +01:00
|
|
|
var HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
|
2015-06-15 15:21:19 +02:00
|
|
|
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");
|
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',
|
|
|
|
},
|
|
|
|
output: {
|
2017-07-06 20:53:39 +02:00
|
|
|
path: OUTPATH,
|
2018-10-06 22:05:33 +02:00
|
|
|
filename: '[name].[contenthash].js',
|
|
|
|
chunkFilename: '[contenthash].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
|
|
|
],
|
2018-10-09 21:43:35 +02:00
|
|
|
rules: rules
|
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(),
|
2016-11-25 13:31:41 +01:00
|
|
|
new WebpackCleanupPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './src/template.html',
|
|
|
|
title: 'Maputnik'
|
|
|
|
}),
|
2020-02-17 20:03:19 +01:00
|
|
|
new HtmlWebpackInlineSVGPlugin({
|
|
|
|
runPreEmit: true,
|
|
|
|
}),
|
2017-11-29 12:29:48 +01:00
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{
|
|
|
|
from: './src/manifest.json',
|
|
|
|
to: 'manifest.json'
|
2018-10-09 21:43:35 +02:00
|
|
|
}
|
|
|
|
]),
|
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
|
|
|
};
|