https://github.com/gxa/atlas-heatmap
Tip revision: 46e9d88c18e268adb3a2110423d565aa974330a8 authored by Haider Iqbal on 21 August 2019, 16:08:25 UTC
5.2.7
5.2.7
Tip revision: 46e9d88
webpack.config.js
const path = require(`path`)
const CleanWebpackPlugin = require(`clean-webpack-plugin`)
const commonPublicPath = `/dist/` //'/gxa/resources/js-bundles/'
module.exports = {
entry: {
heatmapHighcharts: ['@babel/polyfill', 'whatwg-fetch', './src/Main.js'],
experimentPicker: ['@babel/polyfill', 'whatwg-fetch', './html/ExperimentPicker.js'],
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: `dist`
})
],
output: {
library: `[name]`,
filename: `[name].bundle.js`,
publicPath: commonPublicPath
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: `vendors`,
chunks: `all`
}
}
}
},
module: {
rules: [
{
test: /\.js$/i,
exclude: /node_modules\//,
use: `babel-loader`
},
{
test: /\.(jpe?g|png|gif)$/i,
use: [
{
loader: `file-loader`,
options: { query: { name: `[hash].[ext]`, hash: `sha512`, digest: `hex` } }
},
{
loader: `image-webpack-loader`,
options: {
query: {
bypassOnDebug: true,
mozjpeg: { progressive: true },
gifsicle: { interlaced: true },
optipng: { optimizationLevel: 7 }
}
}
}
]
},
{
test: /\.(svg)$/i,
use: [
{
loader: `file-loader`,
options: { query: { name: `[hash].[ext]`, hash: `sha512`, digest: `hex` } }
}
]
},
]
},
devServer: {
port: 9000,
contentBase: path.resolve(__dirname, `html`),
publicPath: commonPublicPath
}
}