myjsbook 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.js +11 -1
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -26,7 +26,17 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
26
26
|
const __dirname = path.dirname(__filename);
|
|
27
27
|
const packageRoot = path.resolve(__dirname, "..");
|
|
28
28
|
const publicDir = path.join(packageRoot, "public");
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
// Resolve monaco-editor using Node's module resolution so it works whether
|
|
31
|
+
// the package is nested (local install) or hoisted (npx / global install).
|
|
32
|
+
const _require = createRequire(import.meta.url);
|
|
33
|
+
let monacoDir;
|
|
34
|
+
try {
|
|
35
|
+
monacoDir = path.join(path.dirname(_require.resolve("monaco-editor/package.json")), "min");
|
|
36
|
+
} catch {
|
|
37
|
+
// Fallback to the expected local path if resolution somehow fails
|
|
38
|
+
monacoDir = path.join(packageRoot, "node_modules", "monaco-editor", "min");
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
const MIME_TYPES = {
|
|
32
42
|
".html": "text/html; charset=utf-8",
|