ITADN

Bug: hardcoded `../../node_modules/...` breaks for npm consumers (should use module resolution)

#627Closedlionel-sim 创建于 2026-01-30
L
lionel-simcommented
Hi team, we noticed the path to axe script is currently hardcoded like this: ```typescript // for crawlers export const axeScript = path.join(dirname, '../../node_modules/axe-core/axe.min.js'); ``` This works when running from the repo layout, but breaks when consumed as an npm package, because axe-core is resolved relative to the consumer’s node_modules layout (and may be hoisted differently). For example, in our install the correct location ends up effectively at ../../../axe-core/axe.min.js (or elsewhere depending on package manager). Is it possible to use Node’s module resolution instead of assuming a filesystem layout? For example: ```typescript import { createRequire } from "module"; const require = createRequire(import.meta.url); export const axeScript = require.resolve("axe-core/axe.min.js"); ``` This is robust across npm/yarn/pnpm and works both when cloned and when installed as a dependency. Thanks!
关闭于 2026-02-03 1 条评论