-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Removing only side effects imports #3
Comments
@jaywcjlove I'm not sure I understand what linting tools have to do with built-time code transformations. Right now, this plugin would delete imports in all formats, however, I want to delete only imports that looks like this: |
Following your notation it would be: // Input Code
import 'foo';
import { Foo } from 'foo';
import Foo from 'foo';
// Output ↓ ↓ ↓ ↓ ↓ ↓
import { Foo } from 'foo';
import Foo from 'foo'; |
@slavafomin Upgrade |
I don't know if this is the feature you want. |
@jaywcjlove wow, that was quick, thank you. I will try it out. |
I've tried to use the following configuration: {
loader: "babel-loader",
options: {
plugins: [
[
"babel-plugin-transform-remove-imports",
{
test: /^core-js\//,
remove: 'effects',
},
],
],
},
} to remove imports that look like: |
@jaywcjlove actually, looking at your implementation I can see a small misunderstanding. I was hoping that |
If you don't mind I would propose the following API: {
loader: "babel-loader",
options: {
plugins: [
[
"babel-plugin-transform-remove-imports",
{
cases: [ // multiple cases could be specified
{
test: /^core-js\//,
remove: "side-effects-only",
},
{
test: "foo", // string could be used
remove: "everything", // default
},
],
},
],
],
},
} Such configuration format would allow to specify multiple cases and will allow extensibility in the future by extending the A |
When the |
@jaywcjlove I believe that when |
@slavafomin Keep |
is there away to prevent the remove of the import in certain files |
Hello!
Thank you for this great plugin!
However, I want to remove only side-effects imports that looks like this:
import 'something'
,but not like these:
import { something } from 'something'
import something from 'something'
Is it possible?
Thanks!
The text was updated successfully, but these errors were encountered: