Skip to content

Fix cdn configuration for test fixture #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/browser/features/angular.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@skip_firefox_60
@skip_safari_11
@skip_on_cdn_build
@skip # Skipped pending PLAT-14002
Feature: Angular

Scenario: Angular route change spans are automatically instrumented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const cdnConfig = {
'react-dom/client': 'ReactDom',
'react-router-dom': 'ReactRouterDom',
'@bugsnag/react-router-performance': 'BugsnagReactRouterPerformance',
'@bugsnag/plugin-react-performance': 'BugsnagPluginReactPerformance',
},
}
}
Expand Down
23 changes: 21 additions & 2 deletions test/browser/features/fixtures/packages/react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@ import replace from '@rollup/plugin-replace';
import path from 'path'
import url from 'url'

import baseConfig from '../rollup.config.mjs'
import baseConfig, { isCdnBuild } from '../rollup.config.mjs'

const __dirname = path.dirname(url.fileURLToPath(import.meta.url))

const cdnConfig = {
// mark everything other than 'src/index.jsx' as an external module when
// using the CDN build
// this stops rollup trying to resolve these modules as we don't run
// 'npm install' when using the CDN build to avoid accidentally testing
// against NPM packages
external: id => id !== 'src/index.jsx' && !id.endsWith('packages/react/src/index.jsx'),
output: {
...baseConfig.output,
globals: {
...baseConfig.output.globals,
react: 'React',
'react-dom/client': 'ReactDom',
'@bugsnag/plugin-react-performance': 'BugsnagPluginReactPerformance',
},
}
}

export default {
...baseConfig,
input: 'src/index.jsx',
Expand All @@ -30,5 +48,6 @@ export default {
'process.env.NODE_ENV': JSON.stringify('production'),
},
})
]
],
...(isCdnBuild ? cdnConfig : {})
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ BugsnagPerformance.start({
autoInstrumentNetworkRequests: false,
})

const container = document.getElementById('root')
const container = document.getElementById("root")
const root = createRoot(container)
root.render(
<React.StrictMode>
Expand Down