Subscribe on changes!

[@vue/compiler-sfc] compileScript now requires passing the `id` option.

avatar
Dec 20th 2020

Version

3.0.4

Reproduction link

https://github.com/mazaiting

Steps to reproduce

version: "vue": "^3.0.4", "@vue/compiler-sfc": "^3.0.4"

problem:

\ 正在编译...[@vue/compiler-sfc] compileScript now requires passing the `id` option.
Upgrade your vite or vue-loader version for compatibility with the latest experimental proposals.

- 正在编译...[@vue/compiler-sfc] compileTemplate now requires the `id` option.`.

how to solve this problem?

What is expected?

What is actually happening?

no this tips.

avatar
Dec 20th 2020

Same issue with rollup out of the box. Config info below:

  "dependencies": {
    "vue": "^3.0.0"
  },
  "devDependencies": {
    "@types/jest": "^24.0.19",
    "@typescript-eslint/eslint-plugin": "^2.33.0",
    "@typescript-eslint/parser": "^2.33.0",
    "@vue/compiler-sfc": "^3.0.4",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^7.0.0-0",
    "prettier": "^1.19.1",
    "rollup": "^2.35.1",
    "rollup-plugin-typescript": "^1.0.1",
    "rollup-plugin-vue": "^6.0.0-beta.10",
    "typescript": "~3.9.3",
    "vue-jest": "^5.0.0-0"
  }

and rollup config:

import vue from "rollup-plugin-vue";
import typescript from "rollup-plugin-typescript";

export default {
  input: "src/components/MyComponent.vue",
  output: {
    format: "esm",
    file: "dist/MyComponent.js"
  },
  external: ["vue"],
  plugins: [
    vue({ optimizeSSR: true }),
    typescript({
      tsconfig: false,
      experimentalDecorators: true,
      module: "es2015"
    })
  ]
};
avatar
Dec 20th 2020

Screen Shot 2020-12-20 at 5 03 14 pm

avatar
Dec 20th 2020

@mazaiting - I've resolved this issue by setting the NODE_ENV.

NODE_ENV=production npx rollup -c - For example removes this error.

avatar
Dec 20th 2020

@mazaiting - I've resolved this issue by setting the NODE_ENV.

NODE_ENV=production npx rollup -c - For example removes this error.

I think setting NODE_ENV is not a good solution, because this problem still occurs during the development process.

avatar
Dec 20th 2020

Read and follow https://new-issue.vuejs.org/?repo=vuejs/vue#why-repro The error might be a miss configuration on a template. In that case open the issue on the template repo

avatar
Dec 21st 2020

Read and follow https://new-issue.vuejs.org/?repo=vuejs/vue#why-repro The error might be a miss configuration on a template. In that case open the issue on the template repo

I think the question template I asked is compliant. Please point out where is the problem?