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

Cannot find module "threadChild.js" #1047

Open
ruk93 opened this issue Mar 5, 2023 · 0 comments
Open

Cannot find module "threadChild.js" #1047

ruk93 opened this issue Mar 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ruk93
Copy link

ruk93 commented Mar 5, 2023

I'm working on a custom build toolchain (something like react-script) using webpack for a project and uses ncc to build the toolchain.
While ncc build process works without any error, I'm having an issue when executing the build output.

This error is not happening when I'm using just tsc (without ncc).

Steps to reproduce,

  1. make custom webpack build script. (input file for NCC)
#!/usr/bin/env node
import * as webpack from "webpack";
import * as webpackDevServer from "webpack-dev-server";
import path from "path";

const filePath = (_path: string) => {
  return path.resolve(__dirname, "../../", _path);
};

const webpackOptions: webpack.Configuration = {
  entry: filePath("src/index.js"),
  mode: "production",
  resolve: { extensions: ["*", ".js", ".jsx"] },
  output: {
    path: filePath("dist" + "/"),
    publicPath: "/dist/",
    filename: "bundle.js",
  }
  //...other config options
};

const compiler = webpack.default(webpackOptions, (err, stats) => {
  console.log(err, stats);
});
  1. Bundle the file using ncc
  2. Execute the output file

Expected Behavior

webpack toolchain (build) should work without any error.

Current Behavior

Error: Cannot find module '/Users/***/Documents/projects/***/threadChild.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at MessagePort.<anonymous> (node:internal/main/worker_thread:159:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Is there any way to fix this missing file ?

Thank you !!

@styfle styfle added the bug Something isn't working label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants