Skip to content

fix: A building error on windows platform which caused by esmodule _… #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/extract-indices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import path from "path";
import fs from "fs";
import { URL } from 'url';

const __dirname = new URL('.', import.meta.url).pathname;
const pathname = new URL('.', import.meta.url).pathname;
const __dirname = process.platform !== 'win32' ? pathname : pathname.substring(1)

const headers = options => (tree, file) => {
const headers = [];
Expand Down
3 changes: 2 additions & 1 deletion scripts/extract-syntax.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import path from "path";
import fs from "fs";
import { URL } from 'url';

const __dirname = new URL('.', import.meta.url).pathname;
const pathname = new URL('.', import.meta.url).pathname;
const __dirname = process.platform !== 'win32' ? pathname : pathname.substring(1)

const processFile = filepath => {
const raw = fs.readFileSync(filepath, "utf8");
Expand Down
3 changes: 2 additions & 1 deletion scripts/extract-tocs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import path from "path";
import fs from "fs";
import { URL } from 'url';

const __dirname = new URL('.', import.meta.url).pathname;
const pathname = new URL('.', import.meta.url).pathname;
const __dirname = process.platform !== 'win32' ? pathname : pathname.substring(1)

// orderArr: ["introduction", "overview",,...]
const orderFiles = (filepaths, orderArr) => {
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-examples.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import child_process from "child_process";
import path from "path";
import { URL } from 'url';

const __dirname = new URL('.', import.meta.url).pathname;
const pathname = new URL('.', import.meta.url).pathname;
const __dirname = process.platform !== 'win32' ? pathname : pathname.substring(1)

let tempFileName = path.join(__dirname, '..', '_tempFile.res')
let tempFileNameRegex = /_tempFile\.res/g
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-hrefs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import urlModule from "url";
import { URL } from 'url';
import {getAllPosts, blogPathToSlug} from '../src/common/BlogApi.mjs'

const __dirname = new URL('.', import.meta.url).pathname;
const pathname = new URL('.', import.meta.url).pathname;
const __dirname = process.platform !== 'win32' ? pathname : pathname.substring(1)

const mapBlogFilePath = path => {
const match = path.match(/\.\/_blogposts\/(.*\.mdx)/);
Expand Down