Skip to content

Commit b74ccc4

Browse files
👷 adjust sandbox build
1 parent 05f295f commit b74ccc4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

‎scripts/dev-server.ts‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import HtmlWebpackPlugin from 'html-webpack-plugin'
44
import webpack from 'webpack'
55
import cors from 'cors'
66
import webpackBase from '../webpack.base.ts'
7-
import logsConfig from '../packages/logs/webpack.config.ts'
8-
import rumSlimConfig from '../packages/rum-slim/webpack.config.ts'
9-
import rumConfig from '../packages/rum/webpack.config.ts'
10-
import flaggingConfig from '../packages/flagging/webpack.config.ts'
11-
import workerConfig from '../packages/worker/webpack.config.ts'
127
import { printLog, runMain } from './lib/executionUtils.ts'
138

149
const sandboxPath = './sandbox'
1510
const port = 8080
1611

12+
const PACKAGES_WITH_BUNDLE = ['rum', 'rum-slim', 'logs', 'flagging', 'worker']
13+
1714
runMain(() => {
1815
const app = express()
1916
app.use(createStaticSandboxApp())
@@ -25,8 +22,19 @@ function createStaticSandboxApp(): express.Application {
2522
const app = express()
2623
app.use(cors())
2724
app.use(express.static(sandboxPath))
28-
for (const config of [rumConfig, rumSlimConfig, logsConfig, flaggingConfig, workerConfig]) {
29-
app.use(middleware(webpack(config(null, { mode: 'development' }))!))
25+
for (const packageName of PACKAGES_WITH_BUNDLE) {
26+
const packagePath = `./packages/${packageName}`
27+
app.use(
28+
middleware(
29+
webpack(
30+
webpackBase({
31+
mode: 'development',
32+
entry: `${packagePath}/src/entries/main.ts`,
33+
filename: packageName === 'worker' ? 'worker.js' : `datadog-${packageName}.js`,
34+
})
35+
)!
36+
)
37+
)
3038
}
3139

3240
// Redirect suffixed files

0 commit comments

Comments
 (0)