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

tools/team-generation-benchmark.js fails because of require path #10644

Open
larry-the-table-guy opened this issue Oct 31, 2024 · 1 comment
Open

Comments

@larry-the-table-guy
Copy link
Contributor

Running node ./tools/team-generation-benchmark.js random gives me this error

$ node ./tools/team-generation-benchmark.js random
node:internal/modules/cjs/loader:1143
  throw err;
  ^

Error: Cannot find module '../sim'
Require stack:
- /redacted/tools/team-generation-benchmark.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/redacted/tools/team-generation-benchmark.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/redacted/tools/team-generation-benchmark.js'
  ]
}

Node.js v18.20.4

I think these lines got left behind during a previous build system migration.

const {Teams} = require('../sim');
const {Dex} = require('../sim/dex');

It works when I add dist/ to the path, but that doesn't seem to trigger a rebuild if the TS files change. I'm pretty clueless when it comes to compiling JS/TS so I don't know what the best fix is.

@asingh04
Copy link
Contributor

I could be wrong, but importing or requireing a TS file in a JS file will not work at all. Building the dist/ folder is probably the right way.

In order to automatically build when changes happen in the TS file, we can probably add a watcher like nodemon

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