Skip to content

Commit

Permalink
feat: load datadog-chunk as separate script from main react app
Browse files Browse the repository at this point in the history
  • Loading branch information
karrui committed Apr 30, 2024
1 parent 1d5716e commit 2c7a9e4
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 63 deletions.
2 changes: 0 additions & 2 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ build-storybook.log
# Lint cache
.eslintcache

#Datadog chunk files
datadog-chunk.*.js
1 change: 0 additions & 1 deletion frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ storybook-static
build-storybook.log

tsconfig.json
tsconfig.dd.json

# all asset json files
**/assets/**/*.json
Expand Down
3 changes: 2 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/index.tsx"></script>
<script type="module" src="./src/index.tsx"></script>
<script type="module" src="./datadog-chunk.ts"></script>
</body>
</html>
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
"start": "vite",
"build": "vite build",
"serve": "vite preview",
"build:dd-chunk": "webpack --config webpack.dd.config.js",
"test": "cross-env SKIP_PREFLIGHT_CHECK=true vitest",
"eject": "react-scripts eject",
"storybook": "NODE_OPTIONS=--openssl-legacy-provider storybook dev -p 6006",
Expand Down
15 changes: 0 additions & 15 deletions frontend/tsconfig.dd.json

This file was deleted.

8 changes: 8 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ export default defineConfig(() => {
build: {
outDir: '../dist/frontend',
emptyOutDir: true,
rollupOptions: {
output: {
// Manually chunk datadog-chunk.ts so it gets preloaded in index.html instead of app.
manualChunks: {
'datadog-chunk': ['datadog-chunk.ts'],
},
},
},
},
base: './',
server: {
Expand Down
43 changes: 0 additions & 43 deletions frontend/webpack.dd.config.js

This file was deleted.

0 comments on commit 2c7a9e4

Please sign in to comment.