mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
请不要在没有先创建Issue的情况下创建Pull Request。 ## 变更的目的是什么 优化Content新增/编辑 ## 简短的更新日志 - [Bugfix] 自定义的高级配置项,在JSON模式下未显示这些配置(#1045) - [Optimize] 提交任务后只保存用户修改的配置,而不是将所有配置都保存起来,目前不论用户有没有修改配置都保存了所有的配置(#1047) ## 验证这一变化 XXXX 请遵循此清单,以帮助我们快速轻松地整合您的贡献: * [ ] 一个 PR(Pull Request的简写)只解决一个问题,禁止一个 PR 解决多个问题; * [ ] 确保 PR 有对应的 Issue(通常在您开始处理之前创建),除非是书写错误之类的琐碎更改不需要 Issue ; * [ ] 格式化 PR 及 Commit-Log 的标题及内容,例如 #861 。PS:Commit-Log 需要在 Git Commit 代码时进行填写,在 GitHub 上修改不了; * [ ] 编写足够详细的 PR 描述,以了解 PR 的作用、方式和原因; * [ ] 编写必要的单元测试来验证您的逻辑更正。如果提交了新功能或重大更改,请记住在 test 模块中添加 integration-test; * [ ] 确保编译通过,集成测试通过;
133 lines
3.9 KiB
JavaScript
133 lines
3.9 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
const StatsPlugin = require('stats-webpack-plugin');
|
|
const HappyPack = require('happypack');
|
|
const os = require('os');
|
|
const happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length });
|
|
const theme = require('./theme');
|
|
const pkgJson = require('../package');
|
|
|
|
const devMode = process.env.NODE_ENV === 'development';
|
|
const babelOptions = {
|
|
cacheDirectory: true,
|
|
babelrc: false,
|
|
presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-typescript'), require.resolve('@babel/preset-react')],
|
|
plugins: [
|
|
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
|
|
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
|
|
[require.resolve('@babel/plugin-proposal-private-methods'), { loose: true }],
|
|
[require.resolve('@babel/plugin-proposal-private-property-in-object'), { loose: true }],
|
|
require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
require.resolve('@babel/plugin-proposal-export-namespace-from'),
|
|
require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
|
require.resolve('@babel/plugin-transform-runtime'),
|
|
require.resolve('@babel/plugin-proposal-optional-chaining'), //
|
|
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'), // 解决 ?? 无法转义问题
|
|
require.resolve('@babel/plugin-proposal-numeric-separator'), // 转义 1_000_000
|
|
devMode && require.resolve('react-refresh/babel'),
|
|
].filter(Boolean),
|
|
};
|
|
|
|
module.exports = {
|
|
entry: {
|
|
[pkgJson.ident]: ['./src/index.tsx'],
|
|
},
|
|
resolve: {
|
|
symlinks: false,
|
|
extensions: ['.web.jsx', '.web.js', '.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
alias: {
|
|
'@src': path.resolve(process.cwd(), 'src'),
|
|
},
|
|
},
|
|
plugins: [
|
|
new ProgressBarPlugin(),
|
|
new CaseSensitivePathsPlugin(),
|
|
new StatsPlugin('manifest.json', {
|
|
chunkModules: false,
|
|
source: true,
|
|
chunks: false,
|
|
modules: false,
|
|
assets: true,
|
|
children: false,
|
|
exclude: [/node_modules/],
|
|
}),
|
|
new HappyPack({
|
|
id: 'babel',
|
|
loaders: [
|
|
'cache-loader',
|
|
{
|
|
loader: 'babel-loader',
|
|
options: babelOptions,
|
|
},
|
|
],
|
|
threadPool: happyThreadPool,
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
|
|
RUN_ENV: JSON.stringify(process.env.RUN_ENV),
|
|
},
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
meta: {
|
|
manifest: 'manifest.json',
|
|
},
|
|
template: './src/index.html',
|
|
inject: 'body',
|
|
}),
|
|
].filter(Boolean),
|
|
module: {
|
|
rules: [
|
|
{
|
|
parser: { system: false },
|
|
},
|
|
{
|
|
test: /\.(js|jsx|ts|tsx)$/,
|
|
exclude: /node_modules\/(?!react-intl|@didi\/dcloud-design)/,
|
|
use: [
|
|
{
|
|
loader: 'happypack/loader?id=babel',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.(png|svg|jpeg|jpg|gif|ttf|woff|woff2|eot|pdf)$/,
|
|
use: [
|
|
{
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: '[name].[ext]',
|
|
outputPath: './assets/image/',
|
|
esModule: false,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.(css|less)$/,
|
|
use: [
|
|
MiniCssExtractPlugin.loader,
|
|
'css-loader',
|
|
{
|
|
loader: 'less-loader',
|
|
options: {
|
|
javascriptEnabled: true,
|
|
modifyVars: theme,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
node: {
|
|
fs: 'empty',
|
|
net: 'empty',
|
|
tls: 'empty',
|
|
},
|
|
stats: 'errors-warnings',
|
|
};
|