-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a note that this requires a bundler that can rewrite the module paths #1
Comments
@ngbrown That is a very valid point, the reason we do that currently is because relative paths where not allowed for declaring modules. At least not as far as I know. If we can solve it in other ways, I'm very open for changing it. |
Maybe there's a way using this in the "baseUrl": "types",
"typeRoots": ["types"], And export pseudo implementations from there instead of module type definitions? Last time I tried to mess with |
@ngbrown What I meant was that I was not able to declare the module with a relative path e.g. |
@thmsndk If the absolute pathed format could be kept, then types could work for players that don't want to bundle or transpile and just work in standard javascript. I seemingly got a start of it working. There's a complication that TypeScript doesn't handle So I have a {
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"checkJs": true,
"isolatedModules": true,
"esModuleInterop": true,
"emitDecoratorMetadata": false,
"module": "ES2020",
"moduleResolution": "Node",
"target": "ES2020",
"importsNotUsedAsValues": "error",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"/arena": ["types/arena"],
"/arena/*": ["types/arena/*"],
"/game/*": ["types/game/*"]
}
},
"include": ["**/*.js"],
"exclude": ["node_modules"]
} With a folder structure starting like this: This Each file is similar to the existing files, just without the These types could then be installed with a
But how to update the types? Maybe the path isn't to |
The way
@types
relies on a non-rooted module import conflicts with what Screeps Arena actually expects. It would be useful to point that out somewhere.This is handled by a paths rule in the rollup config like this:
https://github.com/screepers/screeps-arena-typescript-starter/blob/c1cbaae579dcdb793d0e4269ce296ea343a2bc69/rollup.config.js#L31-L38
Or like this for esbuild:
The text was updated successfully, but these errors were encountered: