Ai
1 Star 1 Fork 0

RDPStudio/rdpmovy.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
rossning92 提交于 2021-01-30 07:21 +08:00 . Support opening .ts file.
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const fs = require("fs");
const plugins = [];
// Setup HtmlWebpackPlugin for all found entries. Automatically search all
// files under `./examples` folder and add them as webpack entries.
const entries = {};
function addEntry(file) {
const name = path.parse(file).name;
entries[name] = file;
plugins.push(
new HtmlWebpackPlugin({
filename: name + ".html",
template: path.resolve(__dirname, "player.html"),
chunks: [name],
title: name,
})
);
}
module.exports = (env) => {
let openPage = undefined;
const contentBase = [
path.resolve(__dirname, "examples"),
path.resolve(__dirname, "node_modules/ccapture.js/build"),
];
if (env && env.file) {
addEntry(env.file);
openPage = path.parse(env.file).name + ".html";
contentBase.push(path.dirname(env.file));
} else {
// The folder that contains source code and resource files (images, videos,
// etc.)
const entryFolders = [path.resolve(__dirname, "examples")];
entryFolders.forEach((dir) => {
fs.readdirSync(dir).forEach((file) => {
if (path.extname(file).toLowerCase() !== ".js") {
return;
}
const fullPath = path.join(dir, file);
addEntry(fullPath);
});
});
}
plugins.push(
new HtmlWebpackPlugin({
filename: "index.html",
template: path.resolve(__dirname, "index.html"),
chunks: [],
movySceneNames: Object.keys(entries),
})
);
return {
entry: entries,
plugins: plugins,
mode: "development",
resolve: {
modules: [
path.resolve(__dirname, "src"),
path.resolve(__dirname, "node_modules"),
"node_modules",
],
extensions: [".js", ".ts", ".json"],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: path.resolve(__dirname, "node_modules/ts-loader"),
options: {
configFile: path.resolve(__dirname, "tsconfig.json"),
},
},
},
],
},
devServer: {
compress: true,
contentBase,
open: true,
openPage,
stats: "minimal",
},
};
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kkstudio2019/rdpmovy.js.git
git@gitee.com:kkstudio2019/rdpmovy.js.git
kkstudio2019
rdpmovy.js
rdpmovy.js
master

搜索帮助