有没有办法在 codesandbox.io 中使用 npm 脚本?

Is there a way to use npm scripts in codesandbox.io?

我正在尝试 运行 json-server npm in codesandbox。我创建了一个 vanilla 项目并向 package.json 添加了一个依赖项。我必须 运行 一个带有 json-server --watch db.json 的脚本。

在 codesandbox 中有没有办法 运行 脚本?

您需要使用像 Node 这样的容器沙盒,以便能够同时访问 运行 json-服务器并设置您自己的脚本。

以下是有关 CodeSandbox 上可用的不同类型沙箱的更多信息:https://codesandbox.io/docs/environment

顺便说一句,我们有一个您可能感兴趣的 json-服务器模板:https://codesandbox.io/s/json-server-1i5z0