Skip to content

Commit e61cdc8

Browse files
authored
feat: add @remix-run/node/install side-effect to allow --require (#6132)
1 parent 320c7ea commit e61cdc8

File tree

7 files changed

+24
-1
lines changed

7 files changed

+24
-1
lines changed

.changeset/install-globals.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@remix-run/node": patch
3+
"@remix-run/serve": patch
4+
---
5+
6+
add `@remix-run/node/install` side-effect to allow `node --require @remix-run/node/install`

packages/remix-node/install.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

packages/remix-node/install.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* eslint-disable */
2+
'use strict';
3+
4+
var globals = require('./dist/globals.js');
5+
6+
Object.defineProperty(exports, '__esModule', { value: true });
7+
8+
globals.installGlobals();

packages/remix-node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"license": "MIT",
1414
"main": "dist/index.js",
1515
"typings": "dist/index.d.ts",
16-
"sideEffects": false,
16+
"sideEffects": ["./install.js"],
1717
"dependencies": {
1818
"@remix-run/server-runtime": "1.15.0",
1919
"@remix-run/web-fetch": "^4.3.2",

packages/remix-node/rollup.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ module.exports = function rollup() {
4343
{ src: "LICENSE.md", dest: [outputDir, sourceDir] },
4444
{ src: `${sourceDir}/package.json`, dest: outputDir },
4545
{ src: `${sourceDir}/README.md`, dest: outputDir },
46+
// This needs to end up in the root of the pkg but also needs to
47+
// reference other compiled files. Just copying these are easier
48+
// than dealing with output configuration for sharing chunks x-builds.
49+
{ src: `${sourceDir}/install.js`, dest: outputDir },
50+
{ src: `${sourceDir}/install.d.ts`, dest: outputDir },
4651
],
4752
}),
4853
magicExportsPlugin({ packageName, version }),

packages/remix-serve/env.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
import "@remix-run/node/install";
2+
13
process.env.NODE_ENV = process.env.NODE_ENV || "production";

packages/remix-serve/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@remix-run/express": "1.15.0",
21+
"@remix-run/node": "1.15.0",
2122
"compression": "^1.7.4",
2223
"express": "^4.17.1",
2324
"morgan": "^1.10.0"

0 commit comments

Comments
 (0)