Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
13c47b3f
Unverified
Commit
13c47b3f
authored
Jan 23, 2026
by
Tobias Koppers
Committed by
GitHub
Jan 23, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: improve module type error message (#88815)
### What? improve module type error message
parent
c582bf8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
lib.rs
turbopack/crates/turbopack/src/lib.rs
+5
-3
module_rule.rs
turbopack/crates/turbopack/src/module_options/module_rule.rs
+23
-0
No files found.
turbopack/crates/turbopack/src/lib.rs
View file @
13c47b3f
...
@@ -674,10 +674,12 @@ async fn process_default_internal(
...
@@ -674,10 +674,12 @@ async fn process_default_internal(
ModuleIssue
::
new
(
ModuleIssue
::
new
(
*
ident
,
*
ident
,
rcstr!
(
"Invalid module type"
),
rcstr!
(
"Invalid module type"
),
rcstr
!
(
format
!
(
"The module type must be Ecmascript or Typescript to add
\
"The module type must be Ecmascript or Typescript to add
\
Ecmascript transforms"
Ecmascript transforms (got {})"
,
),
module_type
)
.into
(),
Some
(
IssueSource
::
from_source_only
(
current_source
)),
Some
(
IssueSource
::
from_source_only
(
current_source
)),
)
)
.to_resolved
()
.to_resolved
()
...
...
turbopack/crates/turbopack/src/module_options/module_rule.rs
View file @
13c47b3f
use
std
::
fmt
::
Display
;
use
anyhow
::
Result
;
use
anyhow
::
Result
;
use
bincode
::{
Decode
,
Encode
};
use
bincode
::{
Decode
,
Encode
};
use
turbo_rcstr
::
RcStr
;
use
turbo_rcstr
::
RcStr
;
...
@@ -153,3 +155,24 @@ pub enum ModuleType {
...
@@ -153,3 +155,24 @@ pub enum ModuleType {
},
},
Custom
(
ResolvedVc
<
Box
<
dyn
CustomModuleType
>>
),
Custom
(
ResolvedVc
<
Box
<
dyn
CustomModuleType
>>
),
}
}
impl
Display
for
ModuleType
{
fn
fmt
(
&
self
,
f
:
&
mut
std
::
fmt
::
Formatter
<
'_
>
)
->
std
::
fmt
::
Result
{
match
self
{
ModuleType
::
Ecmascript
{
..
}
=>
write!
(
f
,
"Ecmascript"
),
ModuleType
::
Typescript
{
..
}
=>
write!
(
f
,
"Typescript"
),
ModuleType
::
TypescriptDeclaration
{
..
}
=>
write!
(
f
,
"TypescriptDeclaration"
),
ModuleType
::
EcmascriptExtensionless
{
..
}
=>
write!
(
f
,
"EcmascriptExtensionless"
),
ModuleType
::
Json
=>
write!
(
f
,
"Json"
),
ModuleType
::
Raw
=>
write!
(
f
,
"Raw"
),
ModuleType
::
NodeAddon
=>
write!
(
f
,
"NodeAddon"
),
ModuleType
::
CssModule
=>
write!
(
f
,
"CssModule"
),
ModuleType
::
Css
{
..
}
=>
write!
(
f
,
"Css"
),
ModuleType
::
StaticUrlJs
{
..
}
=>
write!
(
f
,
"StaticUrlJs"
),
ModuleType
::
StaticUrlCss
{
..
}
=>
write!
(
f
,
"StaticUrlCss"
),
ModuleType
::
InlinedBytesJs
=>
write!
(
f
,
"InlinedBytesJs"
),
ModuleType
::
WebAssembly
{
..
}
=>
write!
(
f
,
"WebAssembly"
),
ModuleType
::
Custom
(
_
)
=>
write!
(
f
,
"Custom"
),
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment