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

initDev() Not being called in the browser #5785

Closed
d-pollard opened this issue Aug 12, 2020 · 2 comments · Fixed by #5788
Closed

initDev() Not being called in the browser #5785

d-pollard opened this issue Aug 12, 2020 · 2 comments · Fixed by #5788

Comments

@d-pollard
Copy link

Version

3.0.0-rc.5

Reproduction link

https://github.com/d-pollard/testing-vue3

Steps to reproduce

Vue CLI generate a new app;
npm run serve

open dev tools; see that window.__VUE__ isn't set

What is expected?

initDev() should run (setting __VUE__ and running setDevtoolsHook with __VUE_DEVTOOLS_GLOBAL_HOOK__)

What is actually happening?

These fields aren't being set; initDev is being called when we build instead


I can add import 'vue/dist/vue.esm-bundler'; in main.js and it'll set properly

@d-pollard d-pollard changed the title initDev() Not being called in the browser initDev() Not being called in the browser Aug 12, 2020
@yyx990803 yyx990803 transferred this issue from vuejs/core Aug 12, 2020
@sodatea sodatea closed this as completed Aug 13, 2020
@sodatea sodatea reopened this Aug 13, 2020
@d-pollard
Copy link
Author

d-pollard commented Aug 13, 2020

@sodatea - would love to contribute a PR for this; as it stands a fix as I see it would be something like this:

User based approach

vue.config.js

module.exports = {
  runtimeCompiler: process.env.NODE_ENV === 'development'
};

CLI source fix

The alternative would be to check the environment we're running in here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/base.js#L118

webpackConfig.resolve
        .alias
          .set(
            'vue$',
            options.runtimeCompiler || process.env.NODE_ENV === 'development'
              ? 'vue/dist/vue.esm-bundler.js'
              : '@vue/runtime-dom'
          )

Please advise which approach you'd prefer; alternatively, suggest a fix and I'll implement it

sodatea added a commit to sodatea/vue-cli that referenced this issue Aug 14, 2020
The old alias `@vue/runtime-dom` was introduced because webpack HMR has
trouble with pure re-exports. Now that the `vue.runtime.esm-bundler.js`
file also includes a call to `initDev`, it's no longer an issue. This
also enables Dev Tool in Vue 3 runtime.

Fixes vuejs#5785
@sodatea
Copy link
Member

sodatea commented Aug 14, 2020

@d-pollard See #5788

sodatea added a commit that referenced this issue Aug 14, 2020
The old alias `@vue/runtime-dom` was introduced because webpack HMR has
trouble with pure re-exports. Now that the `vue.runtime.esm-bundler.js`
file also includes a call to `initDev`, it's no longer an issue. This
also enables Dev Tool in Vue 3 runtime.

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

Successfully merging a pull request may close this issue.

2 participants