2015-06-15 15:21:19 +02:00
"use strict" ;
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 19:52:16 +01:00
var HtmlWebpackInlineSVGPlugin = require ( 'html-webpack-inline-svg-plugin' ) ;
2017-11-08 11:13:02 +01:00
var CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
2015-06-15 15:21:19 +02:00
const HOST = process . env . HOST || "127.0.0.1" ;
const PORT = process . env . PORT || "8888" ;
module . exports = {
2016-12-16 15:04:17 +01:00
target : 'web' ,
2018-10-06 22:05:33 +02:00
mode : 'development' ,
2016-12-16 15:04:17 +01:00
entry : [
` webpack-dev-server/client?http:// ${ HOST } : ${ PORT } ` ,
` webpack/hot/only-dev-server ` ,
` ./src/index.jsx ` // Your appʼ s entry point
] ,
devtool : process . env . WEBPACK _DEVTOOL || 'cheap-module-source-map' ,
output : {
2017-04-10 10:39:36 +02:00
path : path . join ( _ _dirname , '..' , 'public' ) ,
2016-12-16 15:04:17 +01:00
filename : 'bundle.js'
} ,
resolve : {
2017-11-07 12:05:30 +01:00
extensions : [ '.js' , '.jsx' ]
2016-12-16 15:04:17 +01:00
} ,
module : {
2017-11-06 15:58:23 +01:00
noParse : [
2018-02-07 12:00:24 +01:00
/mapbox-gl\/dist\/mapbox-gl.js/
2017-11-06 15:58:23 +01:00
] ,
2018-10-09 21:43:35 +02:00
rules : rules
2016-12-16 15:04:17 +01:00
} ,
node : {
fs : "empty" ,
2016-12-03 23:28:43 +01:00
net : 'empty' ,
tls : 'empty'
2016-12-16 15:04:17 +01:00
} ,
devServer : {
contentBase : "./public" ,
// do not print bundle build stats
noInfo : true ,
// enable HMR
hot : true ,
// embed the webpack-dev-server runtime into the bundle
inline : true ,
// serve index.html in place of 404 responses to allow HTML5 history
historyApiFallback : true ,
port : PORT ,
2017-11-03 12:04:15 +01:00
host : HOST ,
watchOptions : {
// Disabled polling by default as it causes lots of CPU usage and hence drains laptop batteries. To enable polling add WEBPACK_DEV_SERVER_POLLING to your environment
// See <https://webpack.js.org/configuration/watch/#watchoptions-poll> for details
poll : ( ! ! process . env . WEBPACK _DEV _SERVER _POLLING ? true : false ) ,
2017-11-04 15:24:36 +01:00
watch : false
2017-11-03 12:04:15 +01:00
}
2016-12-16 15:04:17 +01:00
} ,
plugins : [
2017-11-07 12:05:30 +01:00
new webpack . NoEmitOnErrorsPlugin ( ) ,
2016-12-16 15:04:17 +01:00
new webpack . HotModuleReplacementPlugin ( ) ,
new HtmlWebpackPlugin ( {
title : 'Maputnik' ,
template : './src/template.html'
2017-11-08 11:13:02 +01:00
} ) ,
2020-02-17 19:52:16 +01:00
new HtmlWebpackInlineSVGPlugin ( {
runPreEmit : true ,
} ) ,
2017-11-08 11:13:02 +01:00
new CopyWebpackPlugin ( [
{
from : './src/manifest.json' ,
to : 'manifest.json'
}
] )
2016-12-16 15:04:17 +01:00
]
2015-06-15 15:21:19 +02:00
} ;