1 Star 0 Fork 0

mscorlib/electron-react-template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.react.ts 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
mscorlib 提交于 2022-09-19 17:20 +08:00 . first commit
import HtmlWebpackPlugin from "html-webpack-plugin";
import * as path from "path";
import { Configuration as WebpackConfiguration } from "webpack";
import { Configuration as WebpackDevServerConfiguration } from "webpack-dev-server";
const rootPath = path.resolve(__dirname, ".");
interface Configuration extends WebpackConfiguration {
devServer?: WebpackDevServerConfiguration;
}
const config: Configuration = {
resolve: {
extensions: [".tsx", ".ts", ".js"],
mainFields: ["main", "module", "browser"],
alias: {
'@': path.resolve(__dirname, './src/renderer')
}
},
entry: path.resolve(rootPath, "src/renderer", "index.tsx"),
target: "electron-renderer",
devtool: "source-map",
module: {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
include: /src/,
use: {
loader: "ts-loader",
},
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
{
test: /\.less$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'less-loader' }
]
}
],
},
devServer: {
static: {
directory: path.resolve(rootPath, "dist/renderer"),
publicPath: "/",
},
port: 5000,
historyApiFallback: true,
compress: true,
},
output: {
path: path.resolve(rootPath, "dist/renderer"),
filename: "js/[name].js",
},
plugins: [
new HtmlWebpackPlugin({ template: path.resolve(rootPath, "index.html") }),
],
};
export default config;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/mscorlib/electron-react-template.git
git@gitee.com:mscorlib/electron-react-template.git
mscorlib
electron-react-template
electron-react-template
master

搜索帮助