martpie / next-transpile-modules

Next.js plugin to transpile code from node_modules. Please see: https://github.com/martpie/next-transpile-modules/issues/291
MIT License
1.13k stars 85 forks source link

Update next-transpile-modules.js #293

Closed mkstayalive closed 11 months ago

mkstayalive commented 11 months ago

Fixing the following error

TypeError: config.watchOptions.ignored.filter is not a function or its return value is not iterable
    at Object.webpack (/Users/manish/projects/kripaluras-rn/node_modules/next-transpile-modules/src/next-transpile-modules.js:265:42)
    at Object.webpack (/Users/manish/projects/kripaluras-rn/node_modules/next-fonts/index.js:42:27)
    at Object.webpack (/Users/manish/projects/kripaluras-rn/node_modules/next-images/index.js:63:27)
    at Object.webpack (/Users/manish/projects/kripaluras-rn/node_modules/@expo/next-adapter/build/index.js:39:35)
    at getBaseWebpackConfig (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/build/webpack-config.js:2147:32)
    at async Promise.all (index 0)
    at async Span.traceAsyncFn (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/trace/trace.js:103:20)
    at async Span.traceAsyncFn (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/trace/trace.js:103:20)
    at async HotReloader.start (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/server/dev/hot-reloader.js:573:30)
    at async DevServer.prepareImpl (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/server/dev/next-dev-server.js:685:9)
    at async NextServer.prepare (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/server/next.js:165:13)
    at async Server.<anonymous> (/Users/manish/projects/kripaluras-rn/node_modules/next/dist/server/lib/render-server.js:136:17) {
  type: 'TypeError'
}
martpie commented 11 months ago

Hey, thank you very much for that! Can you update the tests to make sure it works?

In scripts/next-update.sh, change NEXT_VERSION to the latest version, run the script, and it should update next.js in all the test apps :)

mkstayalive commented 11 months ago

@martpie I have updated the Next.js version. However I would need help with the tests.

The config.watchOptions.ignored was a regex instead of an array, that's why it was failing:

config.watchOptions {
  aggregateTimeout: 5,
  ignored: /^((?:[^/]*(?:\/|$))*)(\.(git|next)|node_modules)(\/((?:[^/]*(?:\/|$))*)(?:$|\/))?/
}
martpie commented 11 months ago

Just run the script bash scripts/next-update.sh, then push the files here, GitHub Actions will run the tests :) (you will need npm and yarn installed)

mkstayalive commented 11 months ago

There seems to be some issue with resolving the version of shared-ui. Although I can see the version mentioned is 1.0.0, it is still unable to find.

Screen Shot 2023-07-23 at 6 34 26 PM

sh scripts/next-update.sh
==================== NPM ====================

changed 3 packages, and audited 48 packages in 2s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
==================== PNPM ====================
scripts/next-update.sh: line 11: pnpm: command not found
==================== YARN WORKSPACES ====================
yarn add v1.22.19
[1/4] πŸ”  Resolving packages...
Couldn't find any versions for "shared-ui" that matches "^1.0.0"
? Please choose a version of "shared-ui" from this list: (Use arrow keys)
❯ 0.0.8 
? Please choose a version of "shared" from this list: 0.2.0
warning workspace-aggregator-cdb0fa14-158c-4aa9-ab6a-e48cb47ff23b > test-yarn-workspaces > shared > node-uuid@1.3.3: Use uuid module instead
warning workspace-aggregator-cdb0fa14-158c-4aa9-ab6a-e48cb47ff23b > test-yarn-workspaces > shared > bson@0.1.9: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
warning workspace-aggregator-cdb0fa14-158c-4aa9-ab6a-e48cb47ff23b > test-yarn-workspaces > shared > mongodb@1.2.14: Please upgrade to 2.2.19 or higher
warning workspace-aggregator-cdb0fa14-158c-4aa9-ab6a-e48cb47ff23b > test-yarn-workspaces > shared > mongodb > bson@0.1.8: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
error Received malformed response from registry for "shared-ts". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
==================== YARN WORKSPACES SYMLINKS ====================
yarn add v1.22.19
[1/4] πŸ”  Resolving packages...
Couldn't find any versions for "shared-ui" that matches "^1.0.0"
? Please choose a version of "shared-ui" from this list: (Use arrow keys)
❯ 0.0.8 
? Please choose a version of "shared" from this list: 0.2.0
warning workspace-aggregator-13f4cbb5-a78c-455f-bfde-72ce390741c4 > test-yarn-workspaces > shared > node-uuid@1.3.3: Use uuid module instead
warning workspace-aggregator-13f4cbb5-a78c-455f-bfde-72ce390741c4 > test-yarn-workspaces > shared > bson@0.1.9: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
warning workspace-aggregator-13f4cbb5-a78c-455f-bfde-72ce390741c4 > test-yarn-workspaces > shared > mongodb@1.2.14: Please upgrade to 2.2.19 or higher
warning workspace-aggregator-13f4cbb5-a78c-455f-bfde-72ce390741c4 > test-yarn-workspaces > shared > mongodb > bson@0.1.8: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
error Received malformed response from registry for "shared-ts". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
==================== SWC ====================
yarn add v1.22.19
[1/4] πŸ”  Resolving packages...
Couldn't find any versions for "shared" that matches "^1.0.0"
? Please choose a version of "shared" from this list: (Use arrow keys)
Couldn't find any versions for "shared-ui" that matches "^1.0.0"
? Please choose a version of "shared-ui" from this list: 0.0.8
warning workspace-aggregator-9a3f3c96-0137-4268-a54e-26f0c3767095 > test-yarn-workspaces > shared > bson@0.1.9: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
warning workspace-aggregator-9a3f3c96-0137-4268-a54e-26f0c3767095 > test-yarn-workspaces > shared > mongodb@1.2.14: Please upgrade to 2.2.19 or higher
warning workspace-aggregator-9a3f3c96-0137-4268-a54e-26f0c3767095 > test-yarn-workspaces > shared > mongodb > bson@0.1.8: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
warning workspace-aggregator-9a3f3c96-0137-4268-a54e-26f0c3767095 > test-yarn-workspaces > shared > node-uuid@1.3.3: Use uuid module instead
error Received malformed response from registry for "shared-ts". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
==================== WITH-APP-DIR ====================
yarn add v1.22.19
[1/4] πŸ”  Resolving packages...
Couldn't find any versions for "shared" that matches "^1.0.0"
? Please choose a version of "shared" from this list: (Use arrow keys)
Couldn't find any versions for "shared-ui" that matches "^1.0.0"
? Please choose a version of "shared-ui" from this list: 0.0.8
warning workspace-aggregator-1c5dc7a2-bb0f-45ec-81ab-0867b210fa52 > test-yarn-workspaces > shared > bson@0.1.9: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
warning workspace-aggregator-1c5dc7a2-bb0f-45ec-81ab-0867b210fa52 > test-yarn-workspaces > shared > node-uuid@1.3.3: Use uuid module instead
warning workspace-aggregator-1c5dc7a2-bb0f-45ec-81ab-0867b210fa52 > test-yarn-workspaces > shared > mongodb@1.2.14: Please upgrade to 2.2.19 or higher
warning workspace-aggregator-1c5dc7a2-bb0f-45ec-81ab-0867b210fa52 > test-yarn-workspaces > shared > mongodb > bson@0.1.8: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
error Received malformed response from registry for "shared-ts". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
martpie commented 11 months ago

Oh sorry I forgot, please run yarn setup before! Then the script.

martpie commented 11 months ago

(I should definitely add that to the README)

mkstayalive commented 11 months ago

@martpie thanks for the help. I was able to push the updates.

martpie commented 11 months ago

Took over in #294 :)