-
Notifications
You must be signed in to change notification settings - Fork 6
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
tree-shaking does not work #28
Comments
Even if set if (false) {
require('axios');
console.log('tree-shaking');
}
|
Yes, because the address of the require is imported using import at the top of the code during the compilation phase of the code. require doesn't actually work when the code is running. At present, I don't have a good idea to solve this problem. Let me think about it. |
Update to 1.1.10,edit config. vitePluginRequire({ |
The error still exists with v1.1.10, and use specified params ( |
I have passed the test here, please provide the repeat case |
Here it is: https://github.com/eleven-net-cn/vite-require-plugin-error The demo is build library mode (vite) Before, Tree-shaking does not work fine, but, when I tested it just now, It was worked fine (Tree-Shaking) when set Please run |
When 'false', the code is not deleted, but it is not referenced at the top. Components can only do so much. |
The current solution does not solve the problem, the behavior is not as expected. Suggest reopen this issues until better resolved. |
Running code plug-ins cannot parse. The plug-in will only run during the code compilation phase. If you have a better solution, you can suggest a pr to me |
Until this problem is actually fixed, keep it open to help other users know more information. I will read the source code carefully to understand more detail. |
This is not a plug-in to solve the problem, there is no need to open. |
I see what you mean, this plugin cannot override or resolve it. It is recommended to specify this case in README, even if this plugin cannot resolve. This can lead to larger bundle sizes, or debugging code to be bundle into production. Because most users often don't know these details. |
Well, I'll change the document later. |
Awesome thanks |
The same as: WarrenJones/vite-plugin-require-transform#29
The text was updated successfully, but these errors were encountered: