Skip to content
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

TypeError: path.includes is not a function #66

Closed
nitedani opened this issue Mar 14, 2023 · 3 comments
Closed

TypeError: path.includes is not a function #66

nitedani opened this issue Mar 14, 2023 · 3 comments

Comments

@nitedani
Copy link

nitedani commented Mar 14, 2023

After updating telefunc from 0.1.44 to 0.1.51, the SSR build that is bundled with webpack into a single file fails to run.

TypeError: path.includes is not a function
    at assertPosixPath (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:681:40)
    at toPosixPath (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:669:9)
    at isImportBuildOutsideOfCwd (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:366:51)
    at loadServerBuild (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:335:13)
    at loadBuild (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:53535:53)
    at initGlobalContext (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:53634:62)
    at renderPage (file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:55440:53)
    at file:///home/dani/projects/almafa/livekit-test/apps/nodejs/dashboard/dist/main.mjs:191759:58

The issue is in the following function:
importBuildFilePath is a webpack module id here, which is a number.
importBuildFilePath 22892
If I comment the last 3 lines and return false, it works.

function isImportBuildOutsideOfCwd(paths) {
    const cwd = (0, utils_1.getCwd)();
    // We cannot check edge environments. Upon edge deployment the server code is usually bundled right after `$ vite build`, so it's unlikley that the resolved importBuildFilePath doesn't belong to cwd
    if (!cwd)
        return null;
    let importBuildFilePath;
    try {
        importBuildFilePath = paths.importBuildFilePathResolved();
    }
    catch (_a) {
        return null;
    }
    console.log("importBuildFilePath",importBuildFilePath)
    // importBuildFilePath = (0, utils_1.toPosixPath)(importBuildFilePath);
    // (0, utils_1.assertPosixPath)(cwd);
    // return !importBuildFilePath.startsWith(cwd);
    return false;
}
@nitedani
Copy link
Author

if (typeof importBuildFilePath === "number") {
 return false
}

would this work?

@brillout
Copy link
Owner

That is indeed a viable fix.

@brillout
Copy link
Owner

Fix released in 0.1.52.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants