Skip to content

Make a note that this requires a bundler that can rewrite the module paths #1

@ngbrown

Description

@ngbrown

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:

const screepsArenaImportExternal = {
  name: "screeps-arena-import-external",
  setup(build) {
    build.onResolve({ filter: /^\/?(arena|game)($|\/.*)/ }, (args) => {
      return {
        path: args.path.startsWith("/") ? args.path : `/${args.path}`,
        external: true,
      };
    });
  },
};

require('esbuild').build({
  // ...
  plugins: [screepsArenaImportExternal],
  // ...
}).catch(() => process.exit(1));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions