diff --git a/compile.js b/compile.js index 0f4e282..a59350c 100644 --- a/compile.js +++ b/compile.js @@ -59,8 +59,16 @@ async function runTS(options, version = 'release-3.8', app = 'application') { readFile : (fileName) => (sourceStrings.get(fileName)), resolveModuleNames : (moduleNames, containingFile) => ( moduleNames.map((fileName) => { - fileName = `${fileName}.ts`; - return (host.fileExists(fileName)) ? {resolvedFileName:fileName} : undefined; + if (host.fileExists(`${fileName}.ts`)) + return {resolvedFileName:`${fileName}.ts`}; + if (host.fileExists(`${fileName}.tsx`)) + return {resolvedFileName:`${fileName}.tsx`}; + if (host.fileExists(`${fileName}/index.d.ts`)) + return {resolvedFileName:`${fileName}/index.d.ts`}; + if (host.fileExists(`${fileName}/index.ts`)) + return {resolvedFileName:`${fileName}/index.ts`}; + if (host.fileExists(`${fileName}.d.ts`)) + return {resolvedFileName:`${fileName}.d.ts`}; }) ), getSourceFile : (fileName, languageVersion, onError) => { diff --git a/moduleShim.js b/moduleShim.js index df1d035..d64a796 100644 --- a/moduleShim.js +++ b/moduleShim.js @@ -85,4 +85,12 @@ done(false, `Module '${id}' failed to execute`); } }; + + window.define._ = (exports) => { + let id = document.currentScript.id; + let module = getModule(id); + module.publish(exports); + delete module.publish; + delete module.error; + }; })(); \ No newline at end of file diff --git a/react.html b/react.html new file mode 100644 index 0000000..721d2a3 --- /dev/null +++ b/react.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file