-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Description
Describe the bug
I use Vite to build my project. After updating the vite
package from 2.6.14 to 2.7.13 I face the following issue: A module, imported for the side effects only, excluded from the bundle if the root module has the sideEffects
property set to false
in the package.json.
I've also tried to create a bundle using rollup
or webpack
: the result bundles contained modules with side effects.
You can find a sample project attached.
To reproduce, install dependencies and call the build
script. Then search for the ui.stub.secondary
string in the dist
folder. It exists in the rollup
and webpack
bundles, but in the vite
bundle, it exists only in the .map
file.
What changes between the Vite versions lead to such behavior? If this behavior is by design now? If yes, how can we configure Vite to get the old behavior back?
Reproduction
https://github.com/jacksonrr3/vite_issue_project
System Info
System:
OS: Windows 10 10.0.19043
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 4.22 GB / 15.77 GB
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (97.0.1072.76)
Internet Explorer: 11.0.19041.906
npmPackages:
vite: ^2.6.14 => 2.7.13
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.