This commit is contained in:
zh
2025-09-01 16:17:11 +08:00
parent d802602200
commit 6fa99df21c
1035 changed files with 377083 additions and 1 deletions

114
webpack.config.js Normal file
View File

@ -0,0 +1,114 @@
/**
* @Author: Caven
* @Date: 2019-03-28 12:44:36
*/
const path = require('path')
const webpack = require('webpack')
var CopyWebpackPlugin = require('copy-webpack-plugin')
function resolve(dir) {
return path.join(__dirname, dir)
}
// let buildPath = path.resolve(__dirname, 'build/lib')
// let buildPath = 'F:\\workspace\\code\\electronic-sand-table-3.0\\static\\lib'
// let buildPath = 'E:\\sourceCode\\单机版-网络版共享后台\\gisWeb4.0\\static\\lib'
let buildPath = 'D:\\project\\sdk4_demo - 副本\\sdk4_demo\\sdk'
// let buildPath = 'G:\\fs2\\yj\\4.0\\static\\sdk'
// let buildPath = 'D:\\project\\sdk_vue2\\public\\sdk'
// let buildPath = 'D:\\ProgramFiles\\dazugaj_platform\\resources\\app\\dist\\electron\\static\\lib'
// let buildPath = 'E:\\sourceCode\\广西\\web\\static\\lib'
let p = true
let plugins = []
if (p) {
plugins = [
new CopyWebpackPlugin([
{
from: resolve('static/'),
// to: 'E:\\sourceCode\\campus\\sdk',
to: buildPath,
// to: path.resolve(__dirname, 'build/lib'),
// toType: 'dir'
force: true,
toType: 'dir',
transform: function (content) {
return content
},
},
]),
new CopyWebpackPlugin([
{
from: resolve('docs/'),
// to: 'E:\\sourceCode\\campus\\sdk',
to: buildPath,
// to: path.resolve(__dirname, 'build/lib'),
// toType: 'dir'
force: true,
toType: 'dir',
transform: function (content) {
return content
},
},
]),
new webpack.BannerPlugin({
banner: `/*! update time: ${new Date().toLocaleString()}*/`,
raw: true // 确保注释不会被转义
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env)
})
]
}
module.exports = (env) => {
const IS_PROD = (env && env.production) || false
// let plugins = []
if (IS_PROD) {
}
return {
entry: {
YJEarth: ['entry'],
// efflect: ['entry'],
},
devtool: IS_PROD ? false : 'cheap-module-eval-source-map',
output: {
filename: IS_PROD ? '[name].min.js' : '[name].min.js',
// path: path.resolve(__dirname, 'build/lib'),
// path: 'E:\\sourceCode\\campus\\sdk',
path: buildPath,
sourcePrefix: '',
},
amd: {
toUrlUndefined: true,
},
module: {
unknownContextCritical: false,
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/transform-runtime', '@babel/plugin-proposal-class-properties'],
compact: false,
ignore: ['checkTree'],
},
},
],
},
resolve: {
extensions: ['.js', '.json', '.css'],
alias: {
// entry: './src/SDK2.0/index.js',
entry: './src/in/index.js',
// entry: './src/Yanmo/index.js',
},
},
plugins,
}
}