2023-11-15 20:18:19 +01:00
|
|
|
const webpack = require('webpack');
|
2025-07-25 23:14:30 +02:00
|
|
|
const { execSync } = require('child_process');
|
|
|
|
|
|
|
|
|
|
const gitDescribe = execSync('git describe --tags --always', { encoding: 'utf8' }).trim();
|
2023-11-15 20:18:19 +01:00
|
|
|
|
2020-08-08 23:59:13 +02:00
|
|
|
module.exports = {
|
|
|
|
|
"transpileDependencies": [
|
2022-03-18 16:27:55 +01:00
|
|
|
"vuetify",
|
|
|
|
|
"leaflet-arrowheads"
|
2020-08-08 23:59:13 +02:00
|
|
|
],
|
|
|
|
|
devServer: {
|
2023-08-23 19:27:57 +02:00
|
|
|
host: "0.0.0.0",
|
2023-11-02 13:20:41 +01:00
|
|
|
webSocketServer: {
|
|
|
|
|
// Not found in the Webpack docs. Reference:
|
|
|
|
|
// https://github.com/webpack/webpack-dev-server/blob/540c43852ea33f9cb18820e1cef05d5ddb86cc3e/lib/servers/WebsocketServer.js#L21
|
|
|
|
|
options: {
|
|
|
|
|
// Not found in the ws docs. Reference:
|
|
|
|
|
// https://github.com/websockets/ws/blob/d8dd4852b81982fc0a6d633673968dff90985000/lib/websocket-server.js#L68
|
|
|
|
|
path: "/webpack-dev-server"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
client: {
|
|
|
|
|
webSocketURL: "auto://0.0.0.0:0/webpack-dev-server"
|
|
|
|
|
},
|
2020-08-08 23:59:13 +02:00
|
|
|
proxy: {
|
|
|
|
|
"^/api(/|$)": {
|
2025-07-25 20:08:38 +02:00
|
|
|
target: process.env.DOUGAL_API_URL || "http://127.0.0.1:3000",
|
2020-09-06 14:54:03 +02:00
|
|
|
},
|
2023-11-02 13:18:37 +01:00
|
|
|
"^/ws(/|$)": {
|
2025-07-25 20:08:38 +02:00
|
|
|
target: process.env.DOUGAL_API_URL?.replace(/^http(s?):/i, "ws$1:") || "ws://127.0.0.1:3000",
|
2020-08-08 23:59:13 +02:00
|
|
|
ws: true
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-15 00:39:46 +02:00
|
|
|
},
|
|
|
|
|
chainWebpack: config => {
|
|
|
|
|
config
|
|
|
|
|
.plugin('html')
|
|
|
|
|
.tap(args => {
|
|
|
|
|
args[0].title = 'Dougal Web'
|
|
|
|
|
return args
|
|
|
|
|
})
|
2023-10-31 22:41:37 +01:00
|
|
|
},
|
|
|
|
|
configureWebpack: {
|
|
|
|
|
resolve: {
|
|
|
|
|
fallback: {
|
2023-11-01 15:12:30 +01:00
|
|
|
path: require.resolve("path-browserify")
|
2023-10-31 22:41:37 +01:00
|
|
|
}
|
|
|
|
|
},
|
2023-11-15 20:18:19 +01:00
|
|
|
plugins: [
|
|
|
|
|
// Work around for Buffer is undefined:
|
|
|
|
|
// https://github.com/webpack/changelog-v5/issues/10
|
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
|
Buffer: ['buffer', 'Buffer'],
|
2025-07-25 23:14:30 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
'process.env.DOUGAL_FRONTEND_VERSION': JSON.stringify(gitDescribe),
|
|
|
|
|
}),
|
2023-11-15 20:18:19 +01:00
|
|
|
],
|
2023-10-31 22:41:37 +01:00
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
|
|
|
type: 'asset/resource'
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2020-08-08 23:59:13 +02:00
|
|
|
}
|
|
|
|
|
}
|