Skip to content

Correct way to use Steal on Node? #800

@stucox

Description

@stucox

I have some code I wrote to use client-side, but would like to reuse it on the server. It currently depends on my Steal config — specifically a YAML translate() plugin. In general it’d be nice if I could have my Steal config apply both on client & server.

My naive attempt to run my code on Node with Steal in control was:

// start-server.js
import steal from 'steal';
steal.startup({main: 'src/server'});
babel-node start-server.js

But my server-side code also includes modules which use Node builtins, which aren’t found.

I tried adding steal-builtins — but I realised that’s more designed to provide would-be-node modules in the browser — e.g. require('http') loads http-browserify, which realises it’s not running in a browser so throws a no window object present’ error.

I saw that #749 brings these into core — but looks like it’s still using http-browserify, so I’d guess the same issue would arise?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions