volarjs / services

MIT License
137 stars 29 forks source link

Using Prettier Service #48

Open metaskills opened 1 year ago

metaskills commented 1 year ago

Greetings. Was hoping this work would allow me to have Prettier formatting in my Vue's <script setup> tags. If that is what this service is not supposed to help with, apologies.

I have the volar-service-prettier package installed and my volar.config.js file appears like so:

import { volar } from "volar-service-prettier";
export default {
  services: [
    volar({
      languages: ["html", "javascript"],
    }),
  ],
};

However, I get this output in my VS Code and my package.json type is set to module.

[Warn  - 10:31:39 PM] Error [ERR_REQUIRE_ESM]: require() of ES Module /workspaces/project/volar.config.js from /home/vscode/.vscode-server/extensions/vue.volar-1.8.8/dist/server.js not supported.
Instead change the require of volar.config.js in /home/vscode/.vscode-server/extensions/vue.volar-1.8.8/dist/server.js to a dynamic import() which is available in all CommonJS modules.