Skip to content
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

Add support for enabling .mjs extension resolving #6525

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions crates/turbopack/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ async fn base_resolve_options(
ext.push(".jsx".to_string());
}
ext.push(".js".to_string());
if opts.enable_mjs_extension {
ext.push(".mjs".to_string());
}
if opt.enable_node_native_modules {
ext.push(".node".to_string());
}
Expand Down
3 changes: 3 additions & 0 deletions crates/turbopack/src/resolve_options_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub struct ResolveOptionsContext {
#[serde(default)]
pub enable_node_native_modules: bool,
#[serde(default)]
// Enable resolving of .mjs files without the .mjs extension
pub enable_mjs_extension: bool,
#[serde(default)]
/// Enable resolving of the node_modules folder when within the provided
/// directory
pub enable_node_modules: Option<Vc<FileSystemPath>>,
Expand Down
Loading