Skip to content

Cannot import plugin as suggested in esbuild #7

@baodrate

Description

@baodrate

attempting to use the plugin as suggested in the readme:

## Usage
```js
import { build } from "esbuild";
import { copyPlugin } from "@sprout2000/esbuild-copy-plugin";
build({
plugins: [
copyPlugin({
src: "./assets/icon.png",
dest: "./dist/logo.png",
}),
],
});
```

does not work. attempting to run the esbuild script results in this error:

import { copyPlugin } from "@sprout2000/esbuild-copy-plugin";
         ^^^^^^^^^^
SyntaxError: Named export 'copyPlugin' not found. The requested module '@sprout2000/esbuild-copy-plugin' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@sprout2000/esbuild-copy-plugin';
const { copyPlugin } = pkg;

it seems that the workaround suggested by the error message is the only way @sprout2000/esbuild-copy-plugin is imported, from all instances of its usage I can find on github

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