There are two problems about this field.
First:
|
const resolver = resolve.ResolverFactory.createResolver({ |
|
extensions: [".lua"], |
|
enforceExtension: true, // Resolved file must be a lua file |
|
fileSystem: { ...new resolve.CachedInputFileSystem(fs) }, |
|
useSyncFileSystemCalls: true, |
|
symlinks: false, // Do not resolve symlinks to their original paths (that breaks node_modules detection) |
|
}); |
The resolver should add conditions to support export conditions in a published module's package.json like:
{
"exports": {
"./client": {
"require": "./dist/client/index.lua",
"types": "./src/index.ts"
}
},
}
I guess we should add ["node", "require"], and maybe "tstl" ?
Related doc:
Second:
|
resolved = resolve.sync(query, { basedir, extensions: [".js", ".ts", ".tsx"] }); |
resolvePlugin use
node-resolve rather than
enhanced-resolve, which not support this "exports" field.
There are two problems about this field.
First:
TypeScriptToLua/src/transpilation/resolve.ts
Lines 13 to 19 in 93ff05d
The resolver should add conditions to support export conditions in a published module's package.json like:
I guess we should add
["node", "require"], and maybe"tstl"?Related doc:
Second:
TypeScriptToLua/src/transpilation/utils.ts
Line 54 in 93ff05d
resolvePluginusenode-resolverather thanenhanced-resolve, which not support this "exports" field.