Skip to content

Commit

Permalink
symlink node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Feb 8, 2024
1 parent 3c71656 commit 6b3d4ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/runtime/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"

esbuild "github.com/evanw/esbuild/pkg/api"
"github.com/sst/ion/internal/fs"
)

type NodeRuntime struct {
Expand Down Expand Up @@ -129,6 +130,12 @@ func (r *NodeRuntime) Build(ctx context.Context, input *BuildInput) (*BuildOutpu
for _, warning := range result.Warnings {
slog.Error("esbuild error", "error", warning)
}

nodeModules, err := fs.FindUp(file, "node_modules")
if err == nil {
os.Symlink(nodeModules, filepath.Join(input.Out(), "node_modules"))
}

return &BuildOutput{
Handler: input.Handler,
}, nil
Expand Down

0 comments on commit 6b3d4ad

Please sign in to comment.