Skip to content

Commit 29dd908

Browse files
authored
Fix preprocessing not being applied on Windows (#234)
* Fix preprocessing not happening for files on Windows * Add Sarah as contributor * Use path.isAbsolute instead of custom function
1 parent 6d6aa5b commit 29dd908

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"contributors": [
2525
"Daniel Swann (https://github.com/danswann)",
2626
"Longboyy",
27-
"Helloman892"
27+
"Helloman892",
28+
"Sarah Klocke (https://sarahisweird.dev/)"
2829
],
2930
"main": "index.js",
3031
"repository": {

src/processScript/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import rollupPluginJSON from "@rollup/plugin-json"
2626
import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
2727
import type { LaxPartial } from "@samual/lib"
2828
import { assert } from "@samual/lib/assert"
29-
import { relative as getRelativePath } from "path"
29+
import { relative as getRelativePath, sep as pathSeparator, isAbsolute as isAbsolutePath } from "path"
3030
import prettier from "prettier"
3131
import { rollup } from "rollup"
3232
import { supportedExtensions as extensions } from "../constants"
@@ -260,7 +260,7 @@ export async function processScript(code: string, {
260260
{
261261
name: `hackmud-script-manager`,
262262
async transform(code, id) {
263-
if (id.startsWith(`/`) && !id.includes(`/node_modules/`))
263+
if (isAbsolutePath(id) && !id.includes(`${pathSeparator}node_modules${pathSeparator}`))
264264
return (await preprocess(code, { uniqueId })).code
265265

266266
let program!: NodePath<Program>

0 commit comments

Comments
 (0)