@@ -17,6 +17,7 @@ use turbopack::module_options::{
1717 module_options_context:: MdxTransformOptions ,
1818} ;
1919use turbopack_core:: {
20+ chunk:: SourceMapsType ,
2021 issue:: { Issue , IssueExt , IssueStage , OptionStyledString , StyledString } ,
2122 resolve:: ResolveAliasMap ,
2223} ;
@@ -884,6 +885,7 @@ pub struct ExperimentalConfig {
884885 turbopack_module_ids : Option < ModuleIds > ,
885886 turbopack_persistent_caching : Option < bool > ,
886887 turbopack_source_maps : Option < bool > ,
888+ turbopack_input_source_maps : Option < bool > ,
887889 turbopack_tree_shaking : Option < bool > ,
888890 turbopack_scope_hoisting : Option < bool > ,
889891 turbopack_client_side_nested_async_chunking : Option < bool > ,
@@ -1825,18 +1827,43 @@ impl NextConfig {
18251827 }
18261828
18271829 #[ turbo_tasks:: function]
1828- pub async fn client_source_maps ( & self , mode : Vc < NextMode > ) -> Result < Vc < bool > > {
1829- let source_maps = self . experimental . turbopack_source_maps ;
1830- Ok ( Vc :: cell ( source_maps. unwrap_or ( match & * mode. await ? {
1831- NextMode :: Development => true ,
1832- NextMode :: Build => self . production_browser_source_maps ,
1833- } ) ) )
1830+ pub async fn client_source_maps ( & self , mode : Vc < NextMode > ) -> Result < Vc < SourceMapsType > > {
1831+ let input_source_maps = self
1832+ . experimental
1833+ . turbopack_input_source_maps
1834+ . unwrap_or ( true ) ;
1835+ let source_maps = self
1836+ . experimental
1837+ . turbopack_source_maps
1838+ . unwrap_or ( match & * mode. await ? {
1839+ NextMode :: Development => true ,
1840+ NextMode :: Build => self . production_browser_source_maps ,
1841+ } ) ;
1842+ Ok ( match ( source_maps, input_source_maps) {
1843+ ( true , true ) => SourceMapsType :: Full ,
1844+ ( true , false ) => SourceMapsType :: Partial ,
1845+ ( false , _) => SourceMapsType :: None ,
1846+ }
1847+ . cell ( ) )
18341848 }
18351849
18361850 #[ turbo_tasks:: function]
1837- pub fn server_source_maps ( & self ) -> Result < Vc < bool > > {
1838- let source_maps = self . experimental . turbopack_source_maps ;
1839- Ok ( Vc :: cell ( source_maps. unwrap_or ( true ) ) )
1851+ pub fn server_source_maps ( & self ) -> Result < Vc < SourceMapsType > > {
1852+ let input_source_maps = self
1853+ . experimental
1854+ . turbopack_input_source_maps
1855+ . unwrap_or ( true ) ;
1856+ let source_maps = self
1857+ . experimental
1858+ . turbopack_source_maps
1859+ . or ( self . experimental . server_source_maps )
1860+ . unwrap_or ( true ) ;
1861+ Ok ( match ( source_maps, input_source_maps) {
1862+ ( true , true ) => SourceMapsType :: Full ,
1863+ ( true , false ) => SourceMapsType :: Partial ,
1864+ ( false , _) => SourceMapsType :: None ,
1865+ }
1866+ . cell ( ) )
18401867 }
18411868
18421869 #[ turbo_tasks:: function]
0 commit comments