question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Production output contains Function constructor

See original GitHub issue

Describe the bug After running yarn build, the generated files still contain the Function() constructor. Upon trying to upload an extension to the Firefox store, the linter states The Function constructor is eval. in both content-script.js and background.js. I have kept the OOTB vue.config.js and babel.config.js.

To Reproduce Steps to reproduce the behavior:

  1. Fix background.js to point to js/content-script.js
  2. Run yarn build

Expected behavior The output files to be free of eval() and Function() to comply with Mozilla’s CSP.

Desktop (please complete the following information):

  • vue-web-extension version: 2.0.0
  • OS: Windows 10 Pro - 19042.746
  • Node.js version: 14.15.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
t-millercommented, Jan 26, 2021

I appreciate the analysis! I’ll see what I can do, thanks!

0reactions
Kocalcommented, Apr 2, 2021

What about:

Maybe use a Webpack hook to replace || new Function('return this')() by something else while/after transpiling files… 🤷

from https://github.com/Kocal/vue-web-extension/issues/658#issuecomment-767101336?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function() constructor - JavaScript - MDN Web Docs
The Function() constructor creates a new Function object. Calling the constructor directly can create functions dynamically, ...
Read more >
Constructor Function - an overview | ScienceDirect Topics
The file contains three functions: operator constructors, operator destructors, and functions called by the operator host. The operator constructor function ...
Read more >
Constructor in C++ and Types of Constructors - Great Learning
Constructors are class functions that are called when new instances of the class's objects are produced. The constructors share the same name as ......
Read more >
Calling virtual functions inside constructors - Stack Overflow
A constructor must either contain an explicit call to its parent's constructor (which does not have to be the first action - it...
Read more >
Constructor in Java | DigitalOcean
Default constructor only role is to initialize the object and return it to the calling code. Default constructor is always without argument and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found