Closed liuestc closed 6 years ago
所有文件都在源码中提供了。
弱弱问下,前端代码能否类似前后端分离的在本地运行呀? package.json也没看到类似 npm run start之类启动服务的命令? 配置文件webpack.config.js里也没找到相关服务啊 我要是想自己修改代码,该如何做,求指教 谢谢!
@liuestc 找到运行的方法了么,正好看这块,有办法本地运行吗
@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
这个build是打包。如何本地化启动前端工程? @calebman @youseries
为了您的问题能得到及时准确解答,请认真填写下面各个选项,感谢您的配合。
当前使用的URule的具体版本号:
遇到的问题详细描述:
能否提供前端webpack配置相关文件?谢谢 是否可以自定义前端页面的一些东西
涉及到的异常信息(完整异常信息):
想修改一些页面相关的东西
相关截图: