rspack: Failed to resolve xxx in project root error occurred while using inputFileSystem

System Info

System: OS: macOS 14.0 CPU: (12) arm64 Apple M2 Max Memory: 387.53 MB / 64.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 19.9.0 - ~/.nvm/versions/node/v19.9.0/bin/node npm: 9.6.3 - ~/.nvm/versions/node/v19.9.0/bin/npm pnpm: 7.15.0 - ~/.nvm/versions/node/v19.9.0/bin/pnpm Browsers: Chrome: 120.0.6099.109 Safari: 17.0 npmPackages: @rspack/core: ^0.4.4 => 0.4.4

Details

I’m trying to bundle my project using a virtual file system.

Here is my code.

import { rspack } from "@rspack/core";
import { Volume, createFsFromVolume } from "memfs";
  const files = {
    "/index.tsx": `
    import React from 'react';
    import ReactDOM from 'react-dom';
    ReactDOM.render(<div></div> , document.getElementById("root"));`,
  };
  const val = Volume.fromJSON(files);
  const fs = createFsFromVolume(val);
  const compiler = rspack({
    mode: "production",
    entry: "/index.tsx",
    output: {
      filename: "/ouput.js",
    }
  });
  compiler.inputFileSystem = fs;
  compiler.intermediateFileSystem = fs;
  //@ts-ignore
  compiler.outputFileSystem = fs;

  compiler.run((err, result) => {
    const files = val.toJSON();
    console.log(err, result, files);
  });

Here is error message

ERROR in × Failed to resolve /index.tsx in project root

Reproduce link

No response

Reproduce Steps

It can be reproduced by running the code I provided.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 26 (12 by maintainers)

Most upvoted comments

Has support for inputFilesystem been implemented?