Refactor file structure

Rename src/views to src and move index.html and index.tsx to the root directory.
This commit is contained in:
Rankin Zheng 2023-05-06 17:32:01 +08:00
parent d2c0ee9d02
commit 63630ef5e7
4 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { MantineProvider } from '@mantine/core';
import App from './App';
import App from './views/App';
const container = document.getElementById('app')!;
const root = createRoot(container); // createRoot(container!) if you use TypeScript

View File

@ -26,6 +26,7 @@ export default class WebviewManager {
private _getHtmlContent(): string {
const htmlPath = vscode.Uri.joinPath(this._extensionUri, 'dist', 'assets', 'chatPanel.html');
// const htmlPath = vscode.Uri.joinPath(this._extensionUri, 'dist', 'index.html');
const htmlContent = fs.readFileSync(htmlPath.fsPath, 'utf8');
return htmlContent.replace(/<vscode-resource:(\/.+?)>/g, (_, resourcePath) => {

View File

@ -69,7 +69,7 @@ const webviewConfig = {
target: 'web',
mode: 'development',
entry: './src/views/index.tsx',
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
@ -155,7 +155,7 @@ const webviewConfig = {
plugins: [
// generate an HTML file that includes the extension's JavaScript file
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'views', 'index.html'),
template: path.resolve(__dirname, 'src', 'index.html'),
filename: 'index.html',
chunks: ['index']
}),