@edwardxyt/gws-cli
Version:
这是一个web脚手架工具,用于生成基于webpack5,生成typescript+react17+mobx5+reactRouter6的应用。初衷是要解决多入口,多环境。单独编译单独运行的脚手架。做到小而美。拒绝锦上添花。
43 lines (39 loc) • 1.3 kB
JavaScript
const webpack = require("webpack");
const path = require("path");
const debug = require("debug");
const echo = debug("compile:webpack-vendor");
const log = console.log;
// 加载全局配置文件
echo("加载全局文件");
let rootDir = path.resolve(__dirname, "../");
let app_config = require(".")(rootDir);
module.exports = async () => {
// log(app_config);
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
entry: {
vendor: app_config.library
},
output: {
path: `${app_config.dist}/${app_config.entry}/static/dll`,
filename: "MyDll.[name].js",
library: "[name]_[hash]"
},
resolve: app_config.resolve,
plugins: [
new webpack.DllPlugin({
path: path.join(
app_config.dist,
app_config.entry,
"static",
"dll",
"[name]-manifest.json"
),
name: "[name]_[hash]"
})
]
});
}, 0);
});
};