Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.
This repository was archived by the owner on May 11, 2024. It is now read-only.

Solution ES6 requirement for full path endings #20

Description

@mo3g666

const SWC_CONFIG = {
jsc: {
parser: {
syntax: 'typescript',
dynamicImport: true,
decorators: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
},
target: 'es2020',
},
sourceMaps: false,
};

In order not to have to specify the extension ./fileName.js or dirName/index.js when importing in the TS code, it is necessary to add a field in SWC_CONFIG:

const SWC_CONFIG = {
...
module: {
    type: "es6",
    strictMode: true,
    noInterop: false,
    resolveFully: true,
  },
}

And for aliases to work, you need to duplicate baseUrl and paths in SWC_CONFIG.jsc:

const SWC_CONFIG = {
...
jsc: {
...
   baseUrl: "./",
    paths: {
      "@server/*": ["./src/core/server/*"],
      "@client/*": ["./src/core/client/*"],
      "@shared/*": ["./src/core/shared/*"],
    },
  },
...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions