Commit 67ff7127 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

WIP

parent f230aa3b
import * as React from 'react'
export default function Root({ children }) {
return (
<html>
<head></head>
<body>{children}</body>
</html>
)
}
import { createTwoslasher } from 'twoslash'
import ts from 'typescript'
export function GET(request) {
try {
const options = request.nextUrl.searchParams.has('esnext')
? {
target: ts.ScriptTarget.ESNext,
lib: ['ESNext', 'DOM', 'esnext', 'dom', 'es2020'],
}
: {}
const code = `type X = Promise<number>;
'hello'.toUpperCase()`
const twoslasher = createTwoslasher({
compilerOptions: options,
})
const result = twoslasher(code)
return Response.json(result)
} catch (e) {
return Response.json({ error: e })
}
}
import * as React from 'react'
export default function page() {
return <div>hello</div>
}
module.exports = { const path = require('path')
experimental: {
appDir: true, /** @type {import('next').NextConfig} */
const nextConfig = {
// output: 'standalone',
// TODO ideally, all of these manual includes wouldn't be necessary, but they are still needed for Webpack
outputFileTracingIncludes: process.env.TURBOPACK
? undefined
: {
'/': [
'../../' +
path.relative(
process.cwd(),
path.resolve(
require.resolve('typescript/package.json'),
'..',
'lib',
'lib.*.d.ts'
)
),
'../../node_modules/@types/node/**',
],
}, },
serverExternalPackages: ['twoslash'],
} }
// console.log(nextConfig.outputFileTracingIncludes)
module.exports = nextConfig
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"webpack-bundle-analyzer": "^4.6.1", "webpack-bundle-analyzer": "^4.6.1",
"webpack-stats-plugin": "^1.1.0", "webpack-stats-plugin": "^1.1.0",
"next": "workspace:*", "next": "workspace:*",
"next-minimal-server": "workspace:*" "next-minimal-server": "workspace:*",
"twoslash": "0.3.4"
}, },
"scripts": { "scripts": {
"build-application": "next build", "build-application": "next build",
......
import * as React from 'react'
export default function page() {
return <div> hello world </div>
}
export async function getServerSideProps() {
return {}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment