-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.dev.ts
More file actions
34 lines (28 loc) · 952 Bytes
/
Copy pathwebpack.dev.ts
File metadata and controls
34 lines (28 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// webpack.dev.ts
import { merge } from 'webpack-merge'
import common from './webpack.common.ts'
import type { Configuration as WebpackConfiguration } from 'webpack'
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server'
import 'dotenv/config' // ← still load .env
const API_HOST = process.env.API_HOST ?? 'localhost'
const API_PORT = process.env.API_PORT ?? process.env.HTTP_PORT ?? '3001'
const devServer: DevServerConfiguration = {
open: true,
port: 3000,
client: { overlay: true },
historyApiFallback: { index: 'index.html' },
proxy: [
{
context: ['/api', '/.well-known'], // proxy REST + BRC-104
target: `http://${API_HOST}:${API_PORT}`,
changeOrigin: true
}
],
static: './public'
}
const developmentConfig: WebpackConfiguration = {
mode: 'development',
devtool: 'inline-source-map',
devServer
}
export default merge<WebpackConfiguration>(common, developmentConfig)