tomjs / vite-plugin-vscode

用 vue/react 来开发 vscode extension webview ,支持 esm 和 cjs。Use vue/react to develop vscode extension webview, supporting esm and cjs.
MIT License
29 stars 1 forks source link

doesn't work workspaces, suggestion fix provided #7

Closed derekrjones closed 2 months ago

derekrjones commented 3 months ago

getWebviewNpmPath() fails in yarn workspaces since WEBVIEW_PACKAGE_NAME is hoisted to root node_modules dir. I was successfully able to get it running by

const clientFile = require.resolve(`${WEBVIEW_PACKAGE_NAME}/client`);
if (!fs.existsSync(clientFile)) { 
  logger.warn(`[${WEBVIEW_PACKAGE_NAME}] is not installed, please install it first!`);
} else { 
  devWebviewClient = fs.readFileSync(clientFile, 'utf-8'); 
} 

which can then remove all of...

https://github.com/tomjs/vite-plugin-vscode/blob/94057884d33f8da730561455e9d45d396817f32b/src/utils.ts#L111-L141

https://github.com/tomjs/vite-plugin-vscode/blob/94057884d33f8da730561455e9d45d396817f32b/src/index.ts#L212-L231

tomgao365 commented 3 months ago

😄Thank you very much for your use and questions. 😂Sorry, I was busy participating in China's 6.18 Shopping Festival and didn't notice your feedback. Please try the new version to see if it solves your problem. (By Google)

derekrjones commented 2 months ago

working great! thanks for the quick release!