Skip to content
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

Import not working properly #5

Closed
Thomasan1999 opened this issue Jul 8, 2021 · 0 comments
Closed

Import not working properly #5

Thomasan1999 opened this issue Jul 8, 2021 · 0 comments

Comments

@Thomasan1999
Copy link

When I try to import the plugin according to the tutorial:

import viteCompression from 'vite-plugin-compression';

export default () => {
  return {
    plugins: [viteCompression()],
  };
};

I get the error: TypeError: viteCompression is not a function. When I use viteCompression.default() instead, it works, but I have to use // @ts-ignore in the line above. The import returns this:

{ default: [Function: src_default] }

When I import the module with the star: import * as viteCompression from 'vite-plugin-compression. It returns an object with double-nested default:

[Module: null prototype] {
  __esModule: true,
  default: { default: [Function: src_default] }
}

This is my tsconfig.json:

{
    "compilerOptions": {
        "target": "es2019",
        "module": "esnext",
        "strict": true,
        "jsx": "preserve",
        "importHelpers": true,
        "moduleResolution": "node",
        "experimentalDecorators": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "sourceMap": true,
        "skipLibCheck": true,
        "baseUrl": ".",
        "noImplicitAny": false
    }
}
@anncwb anncwb closed this as completed in cd6c313 Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant