Unverified Commit 079fe543 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove unused app-turbopack files (#62087)

## What?

Noticed this file was being `require`ed but doesn't actually hold
anything relevant as the flag it adds was removed already.

Also found that in the next-core crate there were files that are no
longer needed as it uses Next.js directly now. That fixes a bug when
running with `NextMode::Build` as well, as it couldn't resolve some of
these unused files.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-2500
parent b3cd381d
/**
* This is the runtime entry point for Next.js App Router client-side bundles.
*/
import '../shims'
import { appBootstrap } from 'next/dist/client/app-bootstrap'
appBootstrap(() => {
require('./app-turbopack')
const { hydrate } = require('./app-index')
hydrate()
})
// eslint-disable-next-line no-undef
self.__next_require__ = __turbopack_require__
// @ts-ignore
// eslint-disable-next-line no-undef
;(self as any).__next_chunk_load__ = __turbopack_load__
......@@ -363,66 +363,34 @@ pub async fn get_client_runtime_entries(
execution_context: Vc<ExecutionContext>,
) -> Result<Vc<RuntimeEntries>> {
let mut runtime_entries = vec![];
let resolve_options_context =
get_client_resolve_options_context(project_root, ty, mode, next_config, execution_context);
match mode {
NextMode::Development => {
let resolve_options_context = get_client_resolve_options_context(
project_root,
ty,
mode,
next_config,
execution_context,
);
let enable_react_refresh =
assert_can_resolve_react_refresh(project_root, resolve_options_context)
.await?
.as_request();
if matches!(mode, NextMode::Development) {
let enable_react_refresh =
assert_can_resolve_react_refresh(project_root, resolve_options_context)
.await?
.as_request();
// It's important that React Refresh come before the regular bootstrap file,
// because the bootstrap contains JSX which requires Refresh's global
// functions to be available.
if let Some(request) = enable_react_refresh {
runtime_entries
.push(RuntimeEntry::Request(request, project_root.join("_".to_string())).cell())
};
// It's important that React Refresh come before the regular bootstrap file,
// because the bootstrap contains JSX which requires Refresh's global
// functions to be available.
if let Some(request) = enable_react_refresh {
runtime_entries
.push(RuntimeEntry::Request(request, project_root.join("_".to_string())).cell())
};
}
if matches!(*ty, ClientContextType::App { .. },) {
runtime_entries.push(
RuntimeEntry::Request(
Request::parse(Value::new(Pattern::Constant(
"next/dist/client/app-next-dev-turbopack.js".to_string(),
))),
project_root.join("_".to_string()),
)
.cell(),
);
}
}
NextMode::Build => match *ty {
ClientContextType::App { .. } => {
runtime_entries.push(
RuntimeEntry::Request(
Request::parse(Value::new(Pattern::Constant(
"./build/client/app-bootstrap.ts".to_string(),
))),
next_js_fs().root().join("_".to_string()),
)
.cell(),
);
}
ClientContextType::Pages { .. } => {
runtime_entries.push(
RuntimeEntry::Request(
Request::parse(Value::new(Pattern::Constant(
"./build/client/bootstrap.ts".to_string(),
))),
next_js_fs().root().join("_".to_string()),
)
.cell(),
);
}
_ => {}
},
if matches!(*ty, ClientContextType::App { .. },) {
runtime_entries.push(
RuntimeEntry::Request(
Request::parse(Value::new(Pattern::Constant(
"next/dist/client/app-next-turbopack.js".to_string(),
))),
project_root.join("_".to_string()),
)
.cell(),
);
}
Ok(Vc::cell(runtime_entries))
......
......@@ -15,7 +15,6 @@ use turbopack_binding::{
},
environment::{Environment, ExecutionEnvironment, NodeJsEnvironment, RuntimeVersions},
free_var_references,
resolve::{parse::Request, pattern::Pattern},
},
ecmascript::{references::esm::UrlRewriteBehavior, TreeShakingMode},
ecmascript_plugin::transform::directives::client::ClientDirectiveTransformer,
......@@ -44,7 +43,7 @@ use crate::{
embed_js::next_js_fs,
mode::NextMode,
next_build::{get_external_next_compiled_package_mapping, get_postcss_package_mapping},
next_client::{RuntimeEntries, RuntimeEntry},
next_client::RuntimeEntries,
next_config::NextConfig,
next_import_map::{get_next_server_import_map, mdx_import_source_file},
next_server::resolve::ExternalPredicate,
......@@ -721,25 +720,10 @@ pub fn get_build_module_options_context() -> Vc<ModuleOptionsContext> {
#[turbo_tasks::function]
pub fn get_server_runtime_entries(
ty: Value<ServerContextType>,
mode: NextMode,
_ty: Value<ServerContextType>,
_mode: NextMode,
) -> Vc<RuntimeEntries> {
let mut runtime_entries = vec![];
if matches!(mode, NextMode::Build) {
if let ServerContextType::AppRSC { .. } = ty.into_value() {
runtime_entries.push(
RuntimeEntry::Request(
Request::parse(Value::new(Pattern::Constant(
"./build/server/app-bootstrap.ts".to_string(),
))),
next_js_fs().root().join("_".to_string()),
)
.cell(),
);
}
}
let runtime_entries = vec![];
Vc::cell(runtime_entries)
}
......
......@@ -6,7 +6,6 @@ window.next.version += '-turbo'
;(self as any).__webpack_hash__ = ''
appBootstrap(() => {
require('./app-turbopack')
const { hydrate } = require('./app-index')
hydrate()
})
......
// @ts-expect-error
process.env.__NEXT_NEW_LINK_BEHAVIOR = true
export {}
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