Skip to content

Provide a ESM export? #27

Closed
Closed
@Cobertos

Description

@Cobertos

When using this plugin inside of a webpack.config.ts I have to do something along the lines of

import _ResolveTypeScriptPlugin from 'resolve-typescript-plugin';
// @ts-ignore
const ResolveTypeScriptPlugin = _ResolveTypeScriptPlugin.default;

as doing both

import ResolveTypeScriptPlugin from 'resolve-typescript-plugin'; and
import * as ResolveTypeScriptPlugin from 'resolve-typescript-plugin'; result in

[webpack-cli] Failed to load '/home/cobertos/Seafile/projects/mapcast/monorepo/pkg/app-auctions/webpack.config.ts' config
[webpack-cli] webpack.config.ts:85:19 - error TS2351: This expression is not constructable.
  Type 'typeof import("/home/cobertos/Seafile/projects/mapcast/monorepo/node_modules/resolve-typescript-plugin/index")' has no construct signatures.

85     plugins: [new ResolveTypeScriptPlugin()]
                     ~~~~~~~~~~~~~~~~~~~~~~~

I think this is because the built index.js is using?

Object.defineProperty(exports, "__esModule", { value: true });
//...
exports.default = ResolveTypescriptPlugin;

instead of commonjs module.exports or ESM export default ....

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions