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

Compiling with vue-cli-service build --mode development --modern produces output that fails to run #3539

Closed
tomnielsen opened this issue Feb 28, 2019 · 1 comment · Fixed by #4034

Comments

@tomnielsen
Copy link

Version

3.4.1

Environment info

MacOS/Chrome 72

FYI: The instructions on this page to run `vue info` does not work anymore.

Steps to reproduce

Steps are so basic, no project is required.

  1. Create a new project with vue create hello-world
  2. Use all defaults when creating.
  3. In new project directory, execute vue-cli-service build --mode development --modern
  4. Try to run outputted vue app.
    Result: Produced project will error with
    Uncaught TypeError: Cannot read property 'webpackHotUpdate' of undefined
    at app.js:5
    at app.js:794

What is expected?

The issue is that globalObject should be self not this

What is actually happening?

The dev version of the code is using 'this' which fails because this is not defined. It should be self.

A fix can clearly be seen in resolveLibConfig.js that probably just never made it into dev.js


globalObject in dev.js should probably have same fix as found in resolveLibConfig.js

See:


vs
globalObject: `(typeof self !== 'undefined' ? self : this)`

My fix to dev.js was:

      webpackConfig
        .output
          .globalObject(`(typeof self !== 'undefined' ? self : this)`)
@MatanYadaev
Copy link

➕1️⃣

sodatea added a commit to sodatea/vue-cli that referenced this issue May 21, 2019
sodatea added a commit that referenced this issue May 25, 2019
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