Closed segevfiner closed 2 years ago
This rollup plugin can be used as a workaround:
{
name: 'vue-devtools-side-effects',
transform(code, id, options?) {
if (/@vue\/devtools\/index.js$/.test(id)) {
return {
code,
moduleSideEffects: false,
map: null,
};
}
},
},
Although you will still get a lot of eval
warnings.
Same here, and the size it adds to the production build is huge!
It doesn't get into production build but the eval warnings are still there. Can these warnings be fixed? The warning is 'Error when using sourcemap for reporting an error: Can't resolve original location of error. Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification' and it shows around 50times for build
Looking for a solution for this as well
Found it here:
// vite.config.js
build: {
rollupOptions: {
onwarn: (warning, warn) => (warning.code !== 'EVAL') ? warn(warning) : undefined // suppress eval warnings (@vue/devtools)
}
}
Can someone explain why the warnings appear in prod mode ( for what is used eval in this case?) ?
Version
6.4.3
Browser and OS info
Chrome 105 / macOS 12.6
Steps to reproduce
import devtools from '@vue/devtools'
&@vue/devtools
doesn't get tree shaken and gets into the production build. I have also seen cases of it importing node specific code which leads to an undefined import toemitter
.What is expected?
For it to be tree shaken so it is easy to include
@vue/devtools
standalone only for dev buildsWhat is actually happening?
It is not tree shaken
Without it being tree shaken, I will have to manually comment/uncomment it. I haven't found a way to direct it to tree shake
@vue/devtools
outside of modifying itspackage.json
and adding"sideEffects": false
. It still spews a huge amount ofeval
warnings despite this which I have no idea how to silence.