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

serverDependenciesToBundle fails in v1.5.1 with RegExps #3251

Closed
ZipBrandon opened this issue May 19, 2022 · 3 comments
Closed

serverDependenciesToBundle fails in v1.5.1 with RegExps #3251

ZipBrandon opened this issue May 19, 2022 · 3 comments

Comments

@ZipBrandon
Copy link

ZipBrandon commented May 19, 2022

What version of Remix are you using?

1.5.1

Steps to Reproduce

Do something similar to https://remix.run/docs/en/v1/api/conventions#serverdependenciestobundle

module.exports = {
  appDirectory: "app",
  assetsBuildDirectory: "public/build",
  publicPath: "/build/",
  serverBuildDirectory: "build",
  ignoredRouteFiles: ["**/.*"],
  serverDependenciesToBundle: [
    /^rehype.*/,
    /^remark.*/,
    /^unified.*/,
    "@sindresorhus/slugify",
  ],
};

Expected Behavior

Remix to accept RegExps for ESM exclusion.

Actual Behavior

TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received an instance of RegExp
   at Object.readConfig (/home/docker/code/app/node_modules/@remix-run/dev/config.js:67:11)
   at Object.build (/home/docker/code/app/node_modules/@remix-run/dev/cli/commands.js:146:31)
   at Object.run (/home/docker/code/app/node_modules/@remix-run/dev/cli/run.js:468:22)
   at Object.<anonymous> (/home/docker/code/app/node_modules/@remix-run/dev/cli.js:16:11)
   at Module._compile (node:internal/modules/cjs/loader:1103:14)
   at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
   at Module.load (node:internal/modules/cjs/loader:981:32)
   at Function.Module._load (node:internal/modules/cjs/loader:822:12)
   at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
   at node:internal/main/run_main_module:17:47
@machour
Copy link
Collaborator

machour commented May 20, 2022

@ZipBrandon just upgraded my app that use RegExps for serverDependenciesToBundle and it's working as expected.
Could you setup a minimal reproduce case on a public repository so that we can see what's going on?

@machour machour added the needs-response We need a response from the original author about this issue/PR label May 20, 2022
@github-actions
Copy link
Contributor

This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that are unactionable. Please reach out if you have more information for us! 🙂

@ZipBrandon
Copy link
Author

Following up on this, this was my error. I had the old API of

const { getDependenciesToBundle } = require(`@remix-run/dev`);
...

  serverDependenciesToBundle: [
    ...getDependenciesToBundle(
      /rehype.*/,
      /remark.*/,
      /unified.*/,
      /micromark.*/,
      /mdast.*/,
      /react-querybuilder.*/,
      /react-day-picker.*/,
      /react-dnd-html5-backend.*/,
      /@udecode\/plate-ui-dnd.*/,
      /@udecode\/plate.*/,
      /@udecode\/plate-serializer-md.*/,
      `@sindresorhus/slugify`,
      `react-markdown`,
      `micromark-util-symbol`,
      `zwitch`,
      `fault`,
      `ccount`,
      `react-dnd`,
      `parse-entities`,
      `stringify-entities`,
      `hastscript`,
      `ts-invariant`,
      `unist-util-map`,
      `markdown-table`,
      `longest-streak`,
      `vfile`,
      `vfile-message`,
      `@apollo/client`,
      `@sindresorhus/transliterate`,
    ),
  ],

@github-actions github-actions bot removed the needs-response We need a response from the original author about this issue/PR label Jun 8, 2022
@github-actions github-actions bot reopened this Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants