mapbox / mapbox/typehead

Add node emulation to `typehead serve`

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
24
Forks
2
PR merge metrics
No merged PRs in 30d

Description

# Description

Parcel bundler has "node integration" which mirrors what Webpack, Browserify, etc do. We wouldn't want to include this in the actual bundle, in case users are using Node.js or a platform we don't recognize, but we can do the following for `typescript serve`:

1) Prepend a `window.global = global;` since ESBuild doesn't do this by default.
2) Add the [esbuild-plugin-node-emulation](https://github.com/zfanta/esbuild-plugin-node-emulation) plugin.

Contributor guide

Open the contributing guide

Research direction

Start at the `typehead serve` entry point and inspect how its esbuild configuration is assembled. Implement the two requested node-emulation steps, then verify that `serve` handles Node-style globals and modules without adding them to the regular bundle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.