Refactor file structure
Rename src/views to src and move index.html and index.tsx to the root directory.
This commit is contained in:
parent
d2c0ee9d02
commit
63630ef5e7
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import { MantineProvider } from '@mantine/core';
|
import { MantineProvider } from '@mantine/core';
|
||||||
import App from './App';
|
import App from './views/App';
|
||||||
|
|
||||||
const container = document.getElementById('app')!;
|
const container = document.getElementById('app')!;
|
||||||
const root = createRoot(container); // createRoot(container!) if you use TypeScript
|
const root = createRoot(container); // createRoot(container!) if you use TypeScript
|
@ -26,6 +26,7 @@ export default class WebviewManager {
|
|||||||
|
|
||||||
private _getHtmlContent(): string {
|
private _getHtmlContent(): string {
|
||||||
const htmlPath = vscode.Uri.joinPath(this._extensionUri, 'dist', 'assets', 'chatPanel.html');
|
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');
|
const htmlContent = fs.readFileSync(htmlPath.fsPath, 'utf8');
|
||||||
|
|
||||||
return htmlContent.replace(/<vscode-resource:(\/.+?)>/g, (_, resourcePath) => {
|
return htmlContent.replace(/<vscode-resource:(\/.+?)>/g, (_, resourcePath) => {
|
||||||
|
@ -69,7 +69,7 @@ const webviewConfig = {
|
|||||||
target: 'web',
|
target: 'web',
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
|
||||||
entry: './src/views/index.tsx',
|
entry: './src/index.tsx',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: 'index.js',
|
filename: 'index.js',
|
||||||
@ -155,7 +155,7 @@ const webviewConfig = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
// generate an HTML file that includes the extension's JavaScript file
|
// generate an HTML file that includes the extension's JavaScript file
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.resolve(__dirname, 'src', 'views', 'index.html'),
|
template: path.resolve(__dirname, 'src', 'index.html'),
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
chunks: ['index']
|
chunks: ['index']
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user