Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IIFE build is broken #1553

Closed
sullivanpt opened this issue May 20, 2020 · 2 comments · Fixed by #1555
Closed

IIFE build is broken #1553

sullivanpt opened this issue May 20, 2020 · 2 comments · Fixed by #1555
Assignees

Comments

@sullivanpt
Copy link

Version

1.0.0

Reproduction link

https://jsfiddle.net/chrisvfritz/50wL7mdz/

Steps to reproduce

Open the following HTML in the browser and observe console error message

<html>
  <body>
    Open the console to observe error message
    <script>
      // hide warning message in karma test
      // see https://github.com/vuejs/vue-test-utils/issues/42
      var VueTemplateCompiler = {}
    </script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/@vue/test-utils@1.0.0/dist/vue-test-utils.iife.js"></script>
  </body>
</html>

What is expected?

IIFE should load without error

What is actually happening?

This new IIFE fails to load in the browser with "Uncaught ReferenceError: testUtils is not defined at vue-test-utils.iife.js:13932"


Last working IIFE was in 1.0.0-beta.33. Broken by #1518 (Optionally hide deprecation errors) which introduces a new import "testUtils" to packages/shared/utils.js. When this new import gets compiled into node_modules/@vue/test-utils/dist/vue-test-utils.iife.js it changes the IIFE signature from (function (...) {...}({}, Vue, VueTemplateCompiler)); to (function (...) {...}({}, Vue, VueTemplateCompiler, testUtils));.

@sullivanpt
Copy link
Author

for the record, I'm working around this issue by adding the following JS before importing the IIFE

window.testUtils = {
  config: {}
}

@lmiller1990
Copy link
Member

We most likely do a check against process.env for the deprecation errors. I can look at this in the next day or two, should be a quick fix. Thanks!

I thought we had some tests around the IIFE build. I guess not. I will add some.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants