You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a basic build plugin written in TypeScript (via Netlify CLI or through Netlify's build pipeline itself upon deployment), it fails with the following error:
TypeError: value.replace is not a function
I believe the underlying culprit might be the ts-node dependency in this repository. I traced it back to the following issue opened here:
Joroze
changed the title
Local Build Plugin using TypeScript: TypeError: value.replace is not a function
Local Build Plugin fails with TypeScript: TypeError: value.replace is not a function
Aug 27, 2024
Describe the bug
When running a basic build plugin written in TypeScript (via Netlify CLI or through Netlify's build pipeline itself upon deployment), it fails with the following error:
TypeError: value.replace is not a function
I believe the underlying culprit might be the
ts-node
dependency in this repository. I traced it back to the following issue opened here:It seems
ts-node
is no longer maintained.Steps to reproduce
With a simple build plugin as mentioned in the Netlify docs, but use TypeScript by renaming your file from
.js
to.ts
like so:index.ts
index.ts
netlify.toml
npx netlify build
CLI command and flags
npx netlify build
Configuration
CLI output
1:18:07 PM: Plugin "./packages/netlify-plugins/my-plugin" internal error
1:18:07 PM: ──────────────────────────────────────────────────────────────────────────────────
1:18:07 PM:
1:18:07 PM: Error message
1:18:07 PM: TypeError: value.replace is not a function
1:18:07 PM:
1:18:07 PM: Plugin details
1:18:07 PM: Package: ./packages/netlify-plugins/my-plugin
1:18:07 PM: Version: 0.0.0
1:18:07 PM:
1:18:07 PM: Error location
1:18:07 PM: While loading "./packages/netlify-plugins/my-plugin" from netlify.toml
1:18:07 PM: at normalizeSlashes (/opt/buildhome/node-deps/node_modules/ts-node/dist/util.js:62:18)
1:18:07 PM: at Object.getExtendsConfigPath (/opt/buildhome/node-deps/node_modules/ts-node/dist/ts-internals.js:24:54)
1:18:07 PM: at readConfig (/opt/buildhome/node-deps/node_modules/ts-node/dist/configuration.js:127:64)
1:18:07 PM: at findAndReadConfig (/opt/buildhome/node-deps/node_modules/ts-node/dist/configuration.js:50:84)
1:18:07 PM: at create (/opt/buildhome/node-deps/node_modules/ts-node/dist/index.js:146:69)
1:18:07 PM: at register (/opt/buildhome/node-deps/node_modules/ts-node/dist/index.js:127:19)
1:18:07 PM: at registerTypeScript (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/typescript.js:12:12)
1:18:07 PM: at Object.load (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/load.js:11:27)
1:18:07 PM: at handleEvent (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/main.js:28:65)
1:18:07 PM: at file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/main.js:23:63
Environment
System:
OS: macOS 15.1
CPU: (8) arm64 Apple M2
Memory: 72.89 MB / 16.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 22.6.0 - ~/.local/share/nvm/v22.6.0/bin/node
npm: 10.8.2 - ~/.local/share/nvm/v22.6.0/bin/npm
npmGlobalPackages:
netlify-cli: 17.34.3
The text was updated successfully, but these errors were encountered: