Skip to content

Fix preprocessing not being applied on Windows #234

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 3 commits into from
Jan 21, 2025
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"contributors": [
"Daniel Swann (https://github.com/danswann)",
"Longboyy",
"Helloman892"
"Helloman892",
"Sarah Klocke (https://sarahisweird.dev/)"
],
"main": "index.js",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/processScript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import rollupPluginJSON from "@rollup/plugin-json"
import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
import type { LaxPartial } from "@samual/lib"
import { assert } from "@samual/lib/assert"
import { relative as getRelativePath } from "path"
import { relative as getRelativePath, sep as pathSeparator, isAbsolute as isAbsolutePath } from "path"
import prettier from "prettier"
import { rollup } from "rollup"
import { supportedExtensions as extensions } from "../constants"
Expand Down Expand Up @@ -260,7 +260,7 @@ export async function processScript(code: string, {
{
name: `hackmud-script-manager`,
async transform(code, id) {
if (id.startsWith(`/`) && !id.includes(`/node_modules/`))
if (isAbsolutePath(id) && !id.includes(`${pathSeparator}node_modules${pathSeparator}`))
return (await preprocess(code, { uniqueId })).code

let program!: NodePath<Program>
Expand Down
Loading