# HG changeset patch
# User Frank Bessou <frank.bessou@logilab.fr>
# Date 1614181958 -3600
#      Wed Feb 24 16:52:38 2021 +0100
# Node ID 18429c2b38f136e36d78c169b8f0869c9cb6df2d
# Parent  daf62961f2766446363f225b0fb8e80a90675f99
chore: include third-pary source maps in demo build

The source maps allow the browser to display original files in the
debugger and in the console.
By default, webpack only includes source maps generated in the current
build. It doesn't include source maps located in node_modules. The
source-map-loader npm packages allow webpack to discover third-party
source maps and the `"devtool": "eval-source-map"` strategy makes
webpack expose both loaded source maps and generated source maps to the
browser.

diff --git a/packages/demo/package.json b/packages/demo/package.json
--- a/packages/demo/package.json
+++ b/packages/demo/package.json
@@ -17,6 +17,7 @@
     "start": "webpack serve --mode=development --port=8001"
   },
   "devDependencies": {
+    "source-map-loader": "^2.0.1",
     "ts-loader": "^8.0.14",
     "webpack": "^5.20.1",
     "webpack-cli": "^4.5.0",
diff --git a/packages/demo/webpack.config.js b/packages/demo/webpack.config.js
--- a/packages/demo/webpack.config.js
+++ b/packages/demo/webpack.config.js
@@ -10,6 +10,11 @@
   module: {
     rules: [
       {
+        test: /\.js$/,
+        enforce: "pre",
+        use: ["source-map-loader"],
+      },
+      {
         test: [/\.tsx?$/],
         loader: "ts-loader",
       },
@@ -20,6 +25,7 @@
       "process.env": {}, // react-admin bundles node code
     }),
   ],
+  devtool: "eval-source-map",
   devServer: {
     publicPath: "/dist/",
   },
diff --git a/yarn.lock b/yarn.lock
--- a/yarn.lock
+++ b/yarn.lock
@@ -567,6 +567,11 @@
   resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
   integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==
 
+abab@^2.0.5:
+  version "2.0.5"
+  resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"
+  integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==
+
 accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
   version "1.3.7"
   resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
@@ -4135,6 +4140,20 @@
   resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
   integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==
 
+source-map-js@^0.6.2:
+  version "0.6.2"
+  resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
+  integrity sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==
+
+source-map-loader@^2.0.1:
+  version "2.0.1"
+  resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-2.0.1.tgz#b4fd0ae7fa7e7d3954300f383f2d6fcc230a4261"
+  integrity sha512-UzOTTQhoNPeTNzOxwFw220RSRzdGSyH4lpNyWjR7Qm34P4/N0W669YSUFdH07+YNeN75h765XLHmNsF/bm97RQ==
+  dependencies:
+    abab "^2.0.5"
+    iconv-lite "^0.6.2"
+    source-map-js "^0.6.2"
+
 source-map-resolve@^0.5.0:
   version "0.5.3"
   resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"