mirror of
https://gitee.com/ByteDance/flowgram.ai.git
synced 2025-07-07 17:43:29 +08:00
75 lines
1.6 KiB
JavaScript
75 lines
1.6 KiB
JavaScript
const path = require('path');
|
|
|
|
const isCI = process.env.CI === 'true';
|
|
const isSCM = !!process.env.BUILD_BRANCH;
|
|
const isProd = process.env.NODE_ENV === 'production';
|
|
/**
|
|
* @type {import('@rspack/cli').Configuration}
|
|
*/
|
|
module.exports = {
|
|
mode: process.env.NODE_ENV,
|
|
context: __dirname,
|
|
target: ['web'],
|
|
entry: {
|
|
main: './src/app.tsx',
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
react: require.resolve('react'),
|
|
'react-dom': require.resolve('react-dom'),
|
|
},
|
|
},
|
|
builtins: {
|
|
// https://www.rspack.dev/config/builtins.html#builtinshtml
|
|
html: [
|
|
{
|
|
template: './index.html',
|
|
},
|
|
],
|
|
progress: !isSCM ? {} : false,
|
|
treeShaking: isProd,
|
|
},
|
|
module: {
|
|
// https://www.rspack.dev/config/module.html#rule
|
|
rules: [
|
|
{
|
|
test: /\.(png|gif|jpg|jpeg|svg|woff2)$/,
|
|
type: 'asset',
|
|
},
|
|
{
|
|
test: /\.(css|less)$/,
|
|
use: [
|
|
{
|
|
loader: 'postcss-loader',
|
|
},
|
|
],
|
|
type: 'css',
|
|
},
|
|
{
|
|
test: /\.module\.css$/i,
|
|
type: 'css/module',
|
|
},
|
|
{
|
|
test: /\.less$/,
|
|
use: [
|
|
{
|
|
loader: 'less-loader',
|
|
},
|
|
],
|
|
type: 'css',
|
|
},
|
|
],
|
|
},
|
|
plugins: [],
|
|
/** module is too large now, we may need better way to tackle this in the future */
|
|
stats: isCI
|
|
? { all: false, modules: true, assets: true, chunks: true, warnings: true, errors: true }
|
|
: {
|
|
modules: false,
|
|
all: false,
|
|
warnings: false,
|
|
errors: true,
|
|
timings: true,
|
|
},
|
|
};
|