Skip to content

Commit

Permalink
enable source maps for the json loader
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 30, 2022
1 parent 16e77e7 commit 6837c35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (loader Loader) IsTypeScript() bool {

func (loader Loader) CanHaveSourceMap() bool {
switch loader {
case LoaderJS, LoaderJSX, LoaderTS, LoaderTSNoAmbiguousLessThan, LoaderTSX, LoaderCSS:
case LoaderJS, LoaderJSX, LoaderTS, LoaderTSNoAmbiguousLessThan, LoaderTSX, LoaderCSS, LoaderJSON:
return true
default:
return false
Expand Down
4 changes: 2 additions & 2 deletions internal/linker/linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1919,10 +1919,10 @@ func (c *linkerContext) generateCodeForLazyExport(sourceIndex uint32) {
// that actually end up being used, and we don't know which ones will
// end up actually being used at this point (since import binding hasn't
// happened yet). So we need to wait until after tree shaking happens.
repr.AST.Parts[partIndex].Stmts = []js_ast.Stmt{{Loc: property.ValueOrNil.Loc, Data: &js_ast.SLocal{
repr.AST.Parts[partIndex].Stmts = []js_ast.Stmt{{Loc: property.Key.Loc, Data: &js_ast.SLocal{
IsExport: true,
Decls: []js_ast.Decl{{
Binding: js_ast.Binding{Loc: property.ValueOrNil.Loc, Data: &js_ast.BIdentifier{Ref: ref}},
Binding: js_ast.Binding{Loc: property.Key.Loc, Data: &js_ast.BIdentifier{Ref: ref}},
ValueOrNil: property.ValueOrNil,
}},
}}}
Expand Down

0 comments on commit 6837c35

Please sign in to comment.