Skip to content

Reserve empty import statements for there could have side effects #6192

@hyf0

Description

@hyf0

Describe the feature

Currently

import { unused } from 'unused'
import { unused2 } from './unused'

will be compressed to

with unused option.

playground link.

IMO, there should be an option called is_imported_module_has_side_effects enabled by default.

With is_imported_module_has_side_effects and unused enabled,

import { unused } from 'unused'
import { unused2 } from './unused'

will be compressed to

import 'unused'
import './unused'

Babel plugin or link to the feature description

No response

Additional context

No response

--edited
Wrong playground link. Fixed now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions