plugins icon indicating copy to clipboard operation
plugins copied to clipboard

Documentation for dynamic-import-vars seems to be outdated (or wrong)

Open KevsRepos opened this issue 3 years ago • 0 comments

  • Rollup Plugin Name: @rollup/plugin-dynamic-import-vars
  • Rollup Plugin Version: 1.4.4

Documentation Is:

  • [ ] Missing
  • [ ] Needed
  • [x] Confusing
  • [x] Not Sure?

Please Explain in Detail...

Using Vite, instead of Rollup directly. The documentation for the dynamic-vars-import seems to claim to import dynamicImportVars from '@rollup/plugin-dynamic-import-vars', though after checking the package internally, it seems that you need to import dynamicImportVariables as this is the default export of the index.ts

I also have the problem that even then, I have to refer to the default property of the import and invoke this one. Maybe a related or different issue.

I could work around it like that:

import dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';

/** @type {import('vite').UserConfig} */
const config = {
	plugins: [dynamicImportVariables.default()]
};

export default config;

Your Proposal for Changes

Either fix the documentation or the package.

KevsRepos avatar Sep 14 '22 12:09 KevsRepos