Compare commits
1 Commits
es5-gulp
...
es-next-we
Author | SHA1 | Date |
---|---|---|
|
1a1b8fd1e8 | 2 years ago |
11 changed files with 164 additions and 111 deletions
@ -0,0 +1,11 @@
|
||||
{ |
||||
"plugins": ["@babel/syntax-dynamic-import"], |
||||
"presets": [ |
||||
[ |
||||
"@babel/preset-env", |
||||
{ |
||||
"modules": false |
||||
} |
||||
] |
||||
] |
||||
} |
@ -1,29 +0,0 @@
|
||||
const { src, dest, series } = require("gulp"); |
||||
const concat = require("gulp-concat"); |
||||
const watch = require("gulp-watch"); |
||||
const browserSync = require("browser-sync").create(); |
||||
|
||||
function buildTask() { |
||||
return src(["src/**/*.js"]) |
||||
.pipe(concat("dec.plugin.demo.js")) |
||||
.pipe(dest("./dist")); |
||||
} |
||||
|
||||
function watchTask(done) { |
||||
watch(["src/**/*.js"], buildTask); |
||||
done(); |
||||
} |
||||
|
||||
function staticServerTask(done) { |
||||
browserSync.init({ |
||||
port: "9009", |
||||
server: { |
||||
baseDir: "./", |
||||
}, |
||||
open:false |
||||
}); |
||||
done(); |
||||
} |
||||
|
||||
exports.buildTask = buildTask; |
||||
exports.devTask = series(buildTask, watchTask, staticServerTask); |
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8" /> |
||||
<title>Webpack App</title> |
||||
</head> |
||||
<body> |
||||
<h1>Hello world!</h1> |
||||
<h2>Tip: Check your console</h2> |
||||
</body> |
||||
|
||||
</html> |
@ -1,20 +1,29 @@
|
||||
{ |
||||
"name": "javascript-dev-demo", |
||||
"name": "my-webpack-project", |
||||
"version": "1.0.0", |
||||
"main": "index.js", |
||||
"repository": "https://code.fanruan.com/dailer/javascript-dev-demo.git", |
||||
"author": "dailer <Dailer@fanruan.com>", |
||||
"repository": "gitea@git.fanruan.com:dailer/javascript-dev-demo.git", |
||||
"author": "zsmj <zsmj1994@gmail.com>", |
||||
"license": "MIT", |
||||
"scripts": { |
||||
"build": "gulp buildTask", |
||||
"dev": "gulp devTask" |
||||
"devDependencies": { |
||||
"@babel/core": "^7.19.6", |
||||
"@babel/preset-env": "^7.19.4", |
||||
"@webpack-cli/generators": "^2.5.0", |
||||
"babel-loader": "^9.0.1", |
||||
"css-loader": "^6.7.1", |
||||
"mini-css-extract-plugin": "^2.6.1", |
||||
"style-loader": "^3.3.1", |
||||
"webpack": "^5.74.0", |
||||
"webpack-cli": "^4.10.0", |
||||
"webpack-dev-server": "^4.11.1" |
||||
}, |
||||
"dependencies": { |
||||
"browser-sync": "^2.27.7", |
||||
"gulp": "^4.0.2", |
||||
"gulp-concat": "^2.6.1", |
||||
"gulp-sourcemaps": "^3.0.0", |
||||
"gulp-watch": "^5.0.1", |
||||
"serve-static": "^1.14.2" |
||||
"description": "My webpack project", |
||||
"scripts": { |
||||
"build": "webpack --mode=production --node-env=production", |
||||
"build:dev": "webpack --mode=development", |
||||
"build:prod": "webpack --mode=production --node-env=production", |
||||
"watch": "webpack --watch", |
||||
"serve": "webpack serve", |
||||
"dev": "webpack serve" |
||||
} |
||||
} |
||||
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 8.7 KiB |
@ -1,18 +1,17 @@
|
||||
// 建议每个文件都包裹一层立即执行函数,避免插件的全局变量污染
|
||||
!(function () { |
||||
// 示例在系统管理新增一个管理节点
|
||||
BI.config("dec.provider.management", function (provider) { |
||||
provider.inject({ |
||||
modules: [ |
||||
{ |
||||
value: "demo", |
||||
id: "decision-plugin-demo", |
||||
text: BI.i18nText("demo示例"), |
||||
cardType: "dec.plugin.demo", |
||||
cls: "dir-font-10", |
||||
gradeAuth: false, |
||||
}, |
||||
], |
||||
}); |
||||
import "./demo.js" |
||||
|
||||
BI.config("dec.provider.management", function (provider) { |
||||
provider.inject({ |
||||
modules: [ |
||||
{ |
||||
value: "demo", |
||||
id: "decision-plugin-demo", |
||||
text: BI.i18nText("demo示例"), |
||||
cardType: "dec.plugin.demo", |
||||
cls: "dir-font-10", |
||||
gradeAuth: false, |
||||
}, |
||||
], |
||||
}); |
||||
}()); |
||||
}); |
||||
|
||||
|
@ -0,0 +1,61 @@
|
||||
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
||||
|
||||
const path = require('path'); |
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
||||
|
||||
const isProduction = process.env.NODE_ENV == 'production'; |
||||
|
||||
|
||||
const stylesHandler = MiniCssExtractPlugin.loader; |
||||
|
||||
|
||||
|
||||
const config = { |
||||
entry: './src/index.js', |
||||
target: ["web", "es5"], |
||||
output: { |
||||
path: path.resolve(__dirname, 'dist'), |
||||
filename: "your-plugin-name.js" |
||||
}, |
||||
devServer: { |
||||
open: true, |
||||
host: 'localhost', |
||||
port: "9090", |
||||
}, |
||||
plugins: [ |
||||
new MiniCssExtractPlugin(), |
||||
|
||||
// Add your plugins here
|
||||
// Learn more about plugins from https://webpack.js.org/configuration/plugins/
|
||||
], |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.(js|jsx)$/i, |
||||
loader: 'babel-loader', |
||||
}, |
||||
{ |
||||
test: /\.css$/i, |
||||
use: [stylesHandler,'css-loader'], |
||||
}, |
||||
{ |
||||
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i, |
||||
type: 'asset', |
||||
}, |
||||
|
||||
// Add your rules for custom modules here
|
||||
// Learn more about loaders from https://webpack.js.org/loaders/
|
||||
], |
||||
}, |
||||
}; |
||||
|
||||
module.exports = () => { |
||||
if (isProduction) { |
||||
config.mode = 'production'; |
||||
|
||||
|
||||
} else { |
||||
config.mode = 'development'; |
||||
} |
||||
return config; |
||||
}; |
Loading…
Reference in new issue