youseries / urule

URULE是一款基于RETE算法的纯Java规则引擎,提供规则集、决策表、决策树、评分卡,规则流等各种规则表现工具及基于网页的可视化设计器,可快速开发出各种复杂业务规则。
Apache License 2.0
1.83k stars 723 forks source link

能否提供前端代码配置文件? #82

Closed liuestc closed 6 years ago

liuestc commented 6 years ago

为了您的问题能得到及时准确解答,请认真填写下面各个选项,感谢您的配合。

能否提供前端webpack配置相关文件?谢谢 是否可以自定义前端页面的一些东西

想修改一些页面相关的东西

youseries commented 6 years ago

所有文件都在源码中提供了。

liuestc commented 6 years ago

弱弱问下,前端代码能否类似前后端分离的在本地运行呀? package.json也没看到类似 npm run start之类启动服务的命令? 配置文件webpack.config.js里也没找到相关服务啊 我要是想自己修改代码,该如何做,求指教 谢谢!

herbomiy commented 6 years ago

@liuestc 找到运行的方法了么,正好看这块,有办法本地运行吗

calebman commented 5 years ago

@liuestc @herbomiy

npm install webpack -g
npm install webpack -s
webpack

在控制台运行 webpack 就行了,webpack默认会自动加载webpack.config.js的配置

写一个build.js脚本,内容如下(同样需要引入webpack依赖)

const webpack = require('webpack')
const webpackConfig = require('./webpack.config')
webpack(webpackConfig )

webpack.config的配置entry中的client模块是不存在的,需要手动移除一下,还可以优化一下配置加上压缩,完整的配置代码如下

'use strict'
const path = require("path")
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")

module.exports = {
  mode: "development",
  devtool: false,
  entry: {
    frame: "./src/frame/index.jsx",
    variableEditor: "./src/variable/index.jsx",
    constantEditor: "./src/constant/index.jsx",
    parameterEditor: "./src/parameter/index.jsx",
    actionEditor: "./src/action/index.jsx",
    packageEditor: "./src/package/index.jsx",
    flowDesigner: "./src/flow/index.jsx",
    ruleSetEditor: "./src/editor/urule/index.jsx",
    decisionTableEditor: "./src/editor/decisiontable/index.jsx",
    scriptDecisionTableEditor: "./src/editor/scriptdecisiontable/index.jsx",
    decisionTreeEditor: "./src/editor/decisiontree/index.jsx",
    ulEditor: "./src/editor/ul/index.jsx",
    scoreCardTable: "./src/scorecard/index.jsx",
    permissionConfigEditor: "./src/permission/index.jsx"
  },
  output: {
    path: path.resolve("../urule-console/src/main/resources/urule-asserts/js"),
    filename: "[name].bundle.js"
  },
  module: {
    rules: [
      {
        test: /\.(jsx|js)?$/,
        exclude: /node_modules/,
        loader: "babel-loader",
        options: {
          presets: ["react", "env"]
        }
      },
      {
        test: /\.css$/,
        use: [{ loader: "style-loader" }, { loader: "css-loader" }]
      },
      {
        test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
        use: [
          {
            loader: "url-loader",
            options: {
              limit: 10000000
            }
          }
        ]
      }
    ]
  },
  plugins: [
    new UglifyJsPlugin({
      uglifyOptions: {
        compress: {
          warnings: false
        }
      },
      sourceMap: false,
      parallel: true
    })
  ]
}

最后使用nodejs运行build.js

node build.js

当然可以在package.json配置npm脚本

"scripts": {
    "build": "node build.js"
  }

执行 npm run build

caojiahui123 commented 4 months ago

这个build是打包。如何本地化启动前端工程? @calebman @youseries