File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 "html-loader" : " ^0.5.5" ,
2626 "html-webpack-plugin" : " ^3.2.0" ,
2727 "monaco-editor-webpack-plugin" : " ^1.8.2" ,
28+ "node-libs-browser" : " ^2.2.1" ,
2829 "pnp-webpack-plugin" : " ^1.5.0" ,
2930 "prettier" : " ^1.19.1" ,
3031 "raw-loader" : " ^4.0.0" ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import TSTLWorker = require("worker-loader?name=tstl.worker.js!./tstlWorker");
88// @ts -ignore
99import FengariWorker = require( "worker-loader?name=fengari.worker.js!./fengariWorker" ) ;
1010
11- import * as tstl from "typescript-to-lua/dist/LuaAST" ;
11+ import * as lua from "typescript-to-lua/dist/LuaAST" ;
1212
1313const renderjson = require ( "renderjson" ) ;
1414const tstlPackageJson = require ( "typescript-to-lua/package.json" ) ;
@@ -127,7 +127,7 @@ if (container && exampleLua && astLua) {
127127 astLua . appendChild (
128128 renderjson . set_show_to_level ( 1 ) . set_replacer ( ( name : string , val : any ) => {
129129 if ( name === "kind" ) {
130- return tstl . SyntaxKind [ val ] ;
130+ return lua . SyntaxKind [ val ] ;
131131 }
132132 return val ;
133133 } ) ( event . data . luaAST ) ,
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
55const PnpWebpackPlugin = require ( "pnp-webpack-plugin" ) ;
66
77const resolve = query => path . resolve ( __dirname , query ) ;
8+ const emptyModulePath = require . resolve ( "node-libs-browser/mock/empty.js" ) ;
89
910/** @type {import("webpack").Configuration } */
1011module . exports = {
@@ -56,5 +57,13 @@ module.exports = {
5657
5758 // Ignore pnpapi reference in patched typescript source
5859 new webpack . IgnorePlugin ( / p n p a p i / ) ,
60+
61+ // Exclude `typescript` from `play_bundle` referenced from `typescript-to-lua/dist/LuaAST`
62+ new webpack . NormalModuleReplacementPlugin ( / t y p e s c r i p t / , resource => {
63+ const { issuer, compiler } = ( resource . resourceResolveData && resource . resourceResolveData . context ) || { } ;
64+ if ( issuer === require . resolve ( "typescript-to-lua/dist/LuaAST" ) && compiler !== "worker" ) {
65+ resource . resource = emptyModulePath ;
66+ }
67+ } ) ,
5968 ] ,
6069} ;
Original file line number Diff line number Diff line change @@ -6353,6 +6353,7 @@ resolve@^1.13.1:
63536353 html-webpack-plugin : ^3.2.0
63546354 monaco-editor : ^0.19.3
63556355 monaco-editor-webpack-plugin : ^1.8.2
6356+ node-libs-browser : ^2.2.1
63566357 pnp-webpack-plugin : ^1.5.0
63576358 prettier : ^1.19.1
63586359 raw-loader : ^4.0.0
You can’t perform that action at this time.
0 commit comments