Comments (1)
The problem is indeed that for technical and performance reasons, rollup does not make assumptions about the argument of the map function, otherwise it would need to iterate through all possible arguments, which can easily add up if an array is passed around in the code. Therefore, Rollup needs to assume that accessing a property could have a side effect.
There are two possible ways to address this:
- Manually declare those mappings as pure via comments https://rollupjs.org/repl/?version=4.0.2&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCcuJTJGdGVzdC5qcyclM0IlNUNuJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlMkMlMjJuYW1lJTIyJTNBJTIybWFpbi5qcyUyMiU3RCUyQyU3QiUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBjb25zdCUyMGElMjAlM0QlMjAlMkYqJTQwX19QVVJFX18qJTJGJTVCJ2ZvbyclNUQubWFwKHMlMjAlM0QlM0UlMjBzJTVCMCU1RCklNUNuZXhwb3J0JTIwY29uc3QlMjBiJTIwJTNEJTIwJTJGKiU0MF9fUFVSRV9fKiUyRiU1Qidmb28nJTVELmZpbHRlcihzJTIwJTNEJTNFJTIwcyU1QjAlNUQlMjAlM0QlM0QlM0QlMjAnZCcpJTVDbmV4cG9ydCUyMGNvbnN0JTIwYyUyMCUzRCUyMCUyRiolNDBfX1BVUkVfXyolMkYlNUInZm9vJyU1RC5yZWR1Y2UoKGElMkMlMjBzKSUyMCUzRCUzRSUyMGElMjAlMkIlMjBzLmxlbmd0aCUyQyUyMDApJTIyJTJDJTIyaXNFbnRyeSUyMiUzQWZhbHNlJTJDJTIybmFtZSUyMiUzQSUyMnRlc3QuanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlN0QlN0QlN0Q=
- Disable side effect detection for property accesses. This is usually a safe choice in most projects unless you explicitly rely on getters with side effects. https://rollupjs.org/repl/?version=4.0.2&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCcuJTJGdGVzdC5qcyclM0IlNUNuJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlMkMlMjJuYW1lJTIyJTNBJTIybWFpbi5qcyUyMiU3RCUyQyU3QiUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBjb25zdCUyMGElMjAlM0QlMjAlNUInZm9vJyU1RC5tYXAocyUyMCUzRCUzRSUyMHMlNUIwJTVEKSU1Q25leHBvcnQlMjBjb25zdCUyMGIlMjAlM0QlMjAlNUInZm9vJyU1RC5maWx0ZXIocyUyMCUzRCUzRSUyMHMlNUIwJTVEJTIwJTNEJTNEJTNEJTIwJ2QnKSU1Q25leHBvcnQlMjBjb25zdCUyMGMlMjAlM0QlMjAlNUInZm9vJyU1RC5yZWR1Y2UoKGElMkMlMjBzKSUyMCUzRCUzRSUyMGElMjAlMkIlMjBzLmxlbmd0aCUyQyUyMDApJTIyJTJDJTIyaXNFbnRyeSUyMiUzQWZhbHNlJTJDJTIybmFtZSUyMiUzQSUyMnRlc3QuanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlN0QlMkMlMjJ0cmVlc2hha2UlMjIlM0ElN0IlMjJwcm9wZXJ0eVJlYWRTaWRlRWZmZWN0cyUyMiUzQWZhbHNlJTdEJTdEJTdE
from rollup.
Related Issues (20)
- When I use format: "es" & sourcemap: false, bundle.write outputs an es module and a systemjs module with a sourcemap HOT 1
- What has been upgraded βterser: 5.27.3β HOT 1
- Exceptional performance of `namespace import` object values
- Cannot figure out a good workflow for a Shopify site...
- Setting `moduleSideEffects: false` removes side effectful getter inside a exported function since 4.9.2 HOT 2
- Rollup incorrectly merging ESM and CJS modules resulting in missing exports
- Treeshake dynamic import of modules
- RollupError: Unexpected token `.`. Expected * for generator, private key, identifier or async HOT 3
- [dir] placeholder for `output.assetFileNames` HOT 3
- I get loads of 'Circular dependency' errors when bundling 'npm link' symlinked modules HOT 1
- Circular dependency hangs watch option
- Vue 3 Script Setup syntax + style tag scoped = bug HOT 2
- Module execution order can be incorrect when having multiple entrypoints HOT 5
- Akims8686
- Rollup should allow building from source. HOT 7
- `preserveSymlinks: 'auto'` HOT 3
- useless import in multientry mode HOT 2
- RangeError: Maximum call stack size exceeded HOT 2
- Input glob error: You must supply options.input to rollup HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rollup.