Skip to content

Commit 4acde2a

Browse files
committed
add bundler tests
1 parent 8d301f8 commit 4acde2a

15 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock=false
2+
install-links=false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function RootLayout({ children }) {
2+
return (
3+
<html lang="en">
4+
<body>{children}</body>
5+
</html>
6+
);
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Home() {
2+
return <h1>OTel Edge Runtime Test</h1>;
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defaultServiceName } from '@opentelemetry/resources';
2+
3+
export function middleware(request) {
4+
const serviceName = defaultServiceName();
5+
console.log('Service name:', serviceName);
6+
return Response.next();
7+
}
8+
9+
export const config = {
10+
matcher: '/api/:path*',
11+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
webpack: (config, { dev }) => {
4+
// Treat warnings as errors
5+
config.plugins.push({
6+
apply: compiler => {
7+
compiler.hooks.done.tap('FailOnWarnings', stats => {
8+
if (stats.compilation.warnings.length > 0) {
9+
console.error(stats.compilation.warnings.join('\n'));
10+
throw new Error('Webpack build has warnings');
11+
}
12+
});
13+
},
14+
});
15+
return config;
16+
},
17+
};
18+
19+
export default nextConfig;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "nextjs-15-edge-bundle-test",
3+
"type": "module",
4+
"private": true,
5+
"scripts": {
6+
"build": "rm -rf .next && next build",
7+
"test:bundle": "npm i && npm run build"
8+
},
9+
"dependencies": {
10+
"@opentelemetry/resources": "file:../../../packages/opentelemetry-resources",
11+
"next": "^15",
12+
"react": "^18",
13+
"react-dom": "^18"
14+
}
15+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "nextjs-15-edge-bundle-test"
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock=false
2+
install-links=false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defaultServiceName } from '@opentelemetry/resources';
2+
3+
export const runtime = 'edge';
4+
5+
export function GET(request) {
6+
const serviceName = defaultServiceName();
7+
return new Response(JSON.stringify({ serviceName }), {
8+
headers: { 'Content-Type': 'application/json' },
9+
});
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function RootLayout({ children }) {
2+
return (
3+
<html lang="en">
4+
<body>{children}</body>
5+
</html>
6+
);
7+
}

0 commit comments

Comments
 (0)