Answer the question
In order to leave comments, you need to log in
How to run a vue.js app inside a script in tampermonkey?
Can't run vue.js app compiled via webpack (standard vue tools) in tampermonkey script.
In the user script itself, only loder.js is loaded, which already loads chunk-vendors.js and app.js via fetch and executes with (new Function (data)) ();
The scripts are downloaded, I see the texts of the scripts in the console, i.e., they are successfully loaded and executed.
If you make console.log in app.js, it is executed.
But in the end I get an error - Vue is not defined.
window.Vue and window.vue are also undefined.
What to do? Where to look?
ZY: Through the introduction of a script by creating a script element, it will not work, since third-party scripts are blocked on the target site.
Answer the question
In order to leave comments, you need to log in
In general, the issue was resolved by changing the Webpack settings, for it it was necessary to optimization
add an option
sideEffects: false
for prduction to the section.
And everything worked, even through eval, even through the connection of the script, even through the introduction of the script code into the page code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question