Skip to content

Plugin Config  #61

@AlexKrupko

Description

@AlexKrupko

What does the bug relate to?

  • Plugin's core
  • Debugger

Describe the bug

Hi there,

I have the following files in the project in ./src/utils:

  • util1.ts
function util1() { /* .... */}
export default util1;
  • util2.ts
function util2() { /* .... */}
export default util2;
  • index.ts
export {default as util1} from './util1';
export {default as util2} from './util2';

Then it's imported with import {util1} from 'utils'; in other files.

I've tried this config -

EntryShakingPlugin({
    targets: [
        {
            glob: 'src/utils/*.ts',
        }
    ],
}),

But I got an error Uncaught SyntaxError: The requested module '/src/utils/index.ts' does not provide an export named 'util1'. And it really doesn't provide util1 because index.ts is empty.

To Reproduce

What am I doing wrong? Is it possible to use this plugin on my file/import/export file structure?

Vite version

5.4.11

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions