maputnik/config/webpack.production.config.js

67 lines
1.6 KiB
JavaScript
Raw Normal View History

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;
var CopyWebpackPlugin = require('copy-webpack-plugin');
var artifacts = require("../test/artifacts");
2015-06-15 15:21:19 +02:00
var OUTPATH = artifacts.pathSync("/build");
2017-07-06 20:53:39 +02:00
2015-06-15 15:21:19 +02:00
module.exports = {
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'
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
noParse: [
/mapbox-gl\/dist\/mapbox-gl.js/
],
2018-10-09 21:43:35 +02:00
rules: rules
},
node: {
2016-12-19 11:33:13 +01:00
fs: "empty",
net: 'empty',
tls: 'empty'
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
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,
}),
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',
})
]
2015-06-15 15:21:19 +02:00
};