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

set target in tsconfig to ES6, vite will not work. #10259

Closed
7 tasks done
danranVm opened this issue Sep 27, 2022 · 1 comment
Closed
7 tasks done

set target in tsconfig to ES6, vite will not work. #10259

danranVm opened this issue Sep 27, 2022 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@danranVm
Copy link

danranVm commented Sep 27, 2022

Describe the bug

This is a breaking change from version 3.1.0, before which it worked fine.

App.vue:6 
       Uncaught TypeError: Cannot read properties of undefined (reading 'accept')
    at App.vue:6:9

I compared the 3.0.9 compilation results and found that the error was caused by the import_meta.hot.accept call.

const import_meta = {};

// ...

import_meta.hot.accept((mod) => {
  // ...
});

Reproduction

  • pnpm create vite my-vue-app --template vue-ts
  • set target in tsconfig to ES6
  • pnpm install
  • pnpm run dev

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 1.71 GB / 15.49 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^3.1.0 => 3.1.0
    vite: ^3.1.0 => 3.1.3

Used Package Manager

pnpm

Logs

Browser console error

App.vue:6 
       Uncaught TypeError: Cannot read properties of undefined (reading 'accept')
    at App.vue:6:9

App.vue compile result

const import_meta = {};
import { defineComponent as _defineComponent } from "/node_modules/.vite/deps/vue.js?v=794990ed";
const _sfc_main = /* @__PURE__ */ _defineComponent({
  __name: "App",
  setup(__props, { expose }) {
    expose();
    const __returned__ = {};
    Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
    return __returned__;
  }
});
import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "/node_modules/.vite/deps/vue.js?v=794990ed";
const _withScopeId = (n) => (_pushScopeId("data-v-7a7a37b1"), n = n(), _popScopeId(), n);
const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createElementVNode("a", {
  href: "https://vitejs.dev",
  target: "_blank"
}, [
  /* @__PURE__ */ _createElementVNode("img", {
    src: "/vite.svg",
    class: "logo",
    alt: "Vite logo"
  })
], -1));
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createElementVNode("a", {
  href: "https://vuejs.org/",
  target: "_blank"
}, [
  /* @__PURE__ */ _createElementVNode("img", {
    src: "/src/assets/vue.svg",
    class: "logo vue",
    alt: "Vue logo"
  })
], -1));
const _hoisted_3 = [
  _hoisted_1,
  _hoisted_2
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return _openBlock(), _createElementBlock("div", null, _hoisted_3);
}
import "/src/App.vue?vue&type=style&index=0&scoped=7a7a37b1&lang.css";
_sfc_main.__hmrId = "7a7a37b1";
typeof __VUE_HMR_RUNTIME__ !== "undefined" && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main);
import_meta.hot.accept((mod) => {
  if (!mod)
    return;
  const { default: updated, _rerender_only } = mod;
  if (_rerender_only) {
    __VUE_HMR_RUNTIME__.rerender(updated.__hmrId, updated.render);
  } else {
    __VUE_HMR_RUNTIME__.reload(updated.__hmrId, updated);
  }
});
import _export_sfc from "/@id/__x00__plugin-vue:export-helper";
export default /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7a7a37b1"], ["__file", "/home/vm/workspace/tools/my-vue-app/src/App.vue"]]);

Validations

@sapphi-red
Copy link
Member

Duplicate of #10167

@sapphi-red sapphi-red marked this as a duplicate of #10167 Sep 28, 2022
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2022
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Sep 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants