babel-plugin-transform-require-ignore icon indicating copy to clipboard operation
babel-plugin-transform-require-ignore copied to clipboard

misleading detail in the readme about the removal of imports

Open travi opened this issue 9 years ago • 1 comments

the readme suggests that this plugin removes both import statements and require statements, when it only actually removes require statements.

normally this works anyway because of the use of a preset like es2015 that converts the code to commonjs before the plugin is used. however, when using a preset that does not include the commonjs conversion, like es2015-rollup, the removal of the import does not happen.

i burned a decent amount of time to this since i'm fairly new to rollup. since this plugin had been working in the context of using the es2015 preset, i didn't investigate this plugin as the cluprit as early as i should have, but instead focused my time learning the internals of rollup. i ended up getting a clear explanation in rollup/rollup-plugin-babel#54

travi avatar Jun 07 '16 14:06 travi

Sorry for the bad README.

I think we may only use this plugin in the node environment. However, nodejs is not ready for the harmony modules. This is why it doesn't handle import.

I hope I have enough time to fix it later. Glad to get a PR, some guides about writting a babel plugin, https://github.com/thejameskyle/babel-handbook

morlay avatar Jun 07 '16 15:06 morlay