-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix the importing of ESModule
node_modules
(#7)
- Loading branch information
Showing
14 changed files
with
160 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# TS-ESNode Test | ||
|
||
This is a test of all diferent TS-ESNode issues and features in an all in one application. | ||
|
||
The main entrypoint has a main import which could start an endless loop of import processing if the core import loading code is broken. | ||
|
||
The core function in the entrypoint includes some logging to ensure the process is being launched properly. | ||
|
||
It also dynamiclly loads Lab2 to ensure dynamic loading of TypeScript ESModules is working. If this is broken it could be with the findFiles function or the dynamic loading within TS-ESNode or Node.JS itself. | ||
|
||
It also imports an example SSR React rendering function [Server.tsx](./src/Server.tsx) to ensure that we can import and load TSX as well as testing the loading of ESModule's from `node_modules`, once imported we run the function and log the resulting html text to console. | ||
|
||
The NPM ESModule React module I'm using in this test/example is [@pika/react](https://github.com/pikapkg/react) to support this running in Node.JS I'm copying a package.json that includes `"type": "module"` as part of the prerun npm script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"_from": "@pika/react", | ||
"_id": "@pika/[email protected]", | ||
"_inBundle": false, | ||
"_integrity": "sha512-v33Ub2QxntNpDFRnkj3tCbT6jMb7Etu7LOMQO/YAulLRIDtDvJdMwuOVJDdPYUmDtWjfWOB5xSP7nl7k0BApbQ==", | ||
"_location": "/@pika/react", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"type": "tag", | ||
"registry": true, | ||
"raw": "@pika/react", | ||
"name": "@pika/react", | ||
"escapedName": "@pika%2freact", | ||
"scope": "@pika", | ||
"rawSpec": "", | ||
"saveSpec": null, | ||
"fetchSpec": "latest" | ||
}, | ||
"_requiredBy": ["#USER", "/"], | ||
"_resolved": "https://registry.npmjs.org/@pika/react/-/react-16.13.1.tgz", | ||
"_shasum": "20e47997d2a2f1e5da39a8e28b75db2ec77d99c6", | ||
"_spec": "@pika/react", | ||
"_where": "/workspace/test", | ||
"bugs": { | ||
"url": "https://github.com/facebook/react/issues" | ||
}, | ||
"bundleDependencies": false, | ||
"type": "module", | ||
"dependencies": {}, | ||
"deprecated": false, | ||
"description": "An actively maintained ESM build of React, the JavaScript library for building user interfaces.", | ||
"homepage": "https://reactjs.org/", | ||
"keywords": ["react"], | ||
"license": "MIT", | ||
"main": "source.production.js", | ||
"module": "source.production.js", | ||
"name": "@pika/react", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/facebook/react.git", | ||
"directory": "packages/react" | ||
}, | ||
"version": "16.13.1" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
declare module '@pika/react' { | ||
import * as ReactTypes from '@pika/react/types/index'; | ||
|
||
export default ReactTypes; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// test/src/Server.tsx | ||
import React from '@pika/react'; | ||
import { renderToStaticMarkup } from 'react-dom/server'; | ||
|
||
export async function renderUI(): Promise<string> { | ||
const [{ CoreApp }] = await Promise.all([import('./helloWorld')]); | ||
|
||
return renderToStaticMarkup(<CoreApp />); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ | |
"allowSyntheticDefaultImports": true, | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*"] | ||
} |