初始化提交

This commit is contained in:
王立帮
2024-07-19 10:16:00 +08:00
parent 4c7b571f20
commit 4a2d56dcc4
7084 changed files with 741212 additions and 63 deletions

74
webpack.common.js Normal file
View File

@@ -0,0 +1,74 @@
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const ORI_DIR = process.cwd();
const DEST_DIR = path.resolve(ORI_DIR, '../../default', path.basename(ORI_DIR));
module.exports = {
cache: false,
entry: path.resolve(ORI_DIR, 'index.js'),
output: {
filename: "[name].bundle.js",
path: DEST_DIR,
clean: true
},
module: {
rules: [
{
test: /\.html$/,
type: "asset/source",
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader'
],
},
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'less-loader',
'postcss-loader'
],
},
{
test: /\.(png|jpe?g|svg|gif)$/,
type: "asset",
parser: {
dataUrlCondition: {
maxSize: 64 * 1024,
},
},
generator: {
filename: "images/[name]_[hash:8][ext]",
},
}
]
},
plugins: [
new MiniCssExtractPlugin({ filename: "styles/[name].[hash:8].css" }),
new CopyPlugin({
patterns: [
{
from: path.resolve(ORI_DIR, 'origin'),
to: DEST_DIR,
noErrorOnMissing: true
}
],
}),
],
externals: {
'blockly/core': 'Blockly',
'mixly': 'Mixly',
'layui': 'layui',
'path': 'path',
'xscrollbar': 'XScrollbar',
'jquery': '$',
'ace': 'ace'
}
};