diff --git a/pandoc.cabal b/pandoc.cabal
index fd95db3ad..b550fa1b0 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -443,6 +443,7 @@ library
      other-modules: Text.Pandoc.Data
   if flag(derive_json_via_th)
      cpp-options:   -DDERIVE_JSON_VIA_TH
+     other-extensions: TemplateHaskell
   if os(windows)
     cpp-options:      -D_WINDOWS
   ghc-options:     -Wall -fno-warn-unused-do-bind