update @生产区分
This commit is contained in:
parent
b7763da877
commit
04da1c5008
17
README.md
17
README.md
|
@ -1,13 +1,13 @@
|
||||||
# 营销系统 模版H5
|
# 营销系统 模版H5
|
||||||
```
|
```
|
||||||
### 默认 npm (pnpm 需要注释 webpack.base.js 配置 resolve-modules)
|
### 依赖包工具 默认 npm (pnpm 需要注释 webpack.base.js 配置 resolve-modules)
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
### 分支介绍
|
### 分支介绍
|
||||||
```
|
```
|
||||||
main 开发分支
|
test 测试分支
|
||||||
|
main 生产分支
|
||||||
```
|
```
|
||||||
|
|
||||||
### 启动项目
|
### 启动项目
|
||||||
|
@ -15,12 +15,7 @@ main 开发分支
|
||||||
npm run start
|
npm run start
|
||||||
```
|
```
|
||||||
|
|
||||||
### 测试打包
|
### 测试/生产打包
|
||||||
```
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
### 生产打包(推荐)
|
|
||||||
```
|
```
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
@ -35,8 +30,8 @@ npm run build
|
||||||
规范:
|
规范:
|
||||||
目录 /src/views/templates
|
目录 /src/views/templates
|
||||||
命名 cmsXxxx
|
命名 cmsXxxx
|
||||||
类组件开发 + 外部文件引入样式 (index.scss)
|
"类组件"开发 + 外部文件引入样式 (index.scss)
|
||||||
props.comType 1 H5 2 配置页(PC)
|
props.comType: 1 H5; 2 配置页(PC)
|
||||||
cdn 引入图片
|
cdn 引入图片
|
||||||
|
|
||||||
注意事项:
|
注意事项:
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { VueLoaderPlugin } = require('vue-loader')
|
const { VueLoaderPlugin } = require('vue-loader')
|
||||||
const { DefinePlugin } = require('webpack');
|
const { DefinePlugin } = require('webpack');
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
const { VantResolver } = require('@vant/auto-import-resolver');
|
const { VantResolver } = require('@vant/auto-import-resolver');
|
||||||
const AutoImport = require('unplugin-auto-import/webpack');
|
const AutoImport = require('unplugin-auto-import/webpack');
|
||||||
const Components = require('unplugin-vue-components/webpack');
|
const Components = require('unplugin-vue-components/webpack');
|
||||||
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: path.join(__dirname, '../src/main.ts'), // 入口文件
|
entry: path.join(__dirname, '../src/main.ts'), // 入口文件
|
||||||
|
@ -82,27 +80,11 @@ module.exports = {
|
||||||
dts: path.resolve(__dirname, "../src/components.d.ts"),
|
dts: path.resolve(__dirname, "../src/components.d.ts"),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimization: {
|
|
||||||
minimize: true,
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({
|
|
||||||
terserOptions: {
|
|
||||||
compress: {
|
|
||||||
// drop_console: true, // 移除所有的`console`语句
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
comments: false, // 去掉注释
|
|
||||||
},
|
|
||||||
},
|
|
||||||
extractComments: false, // 不从代码中提取注释
|
|
||||||
}),
|
|
||||||
new CssMinimizerPlugin(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
resolve: {
|
resolve: {
|
||||||
// 如果用的是pnpm 不要配置这个,会有幽灵依赖的问题,访问不到很多模块
|
// 如果用的是pnpm 不要配置这个,会有幽灵依赖的问题,访问不到很多模块
|
||||||
// 查找第三方模块只在本项目的node_modules中查找
|
// 查找第三方模块只在本项目的node_modules中查找
|
||||||
modules: [path.resolve(__dirname, '../node_modules')],
|
modules: [path.resolve(__dirname, '../node_modules')],
|
||||||
|
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.join(__dirname, '../src')
|
'@': path.join(__dirname, '../src')
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports = {
|
||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
compress: {
|
compress: {
|
||||||
// drop_console: true, // 移除所有的`console`语句
|
drop_console: true, // 移除所有的`console`语句
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
comments: false, // 去掉注释
|
comments: false, // 去掉注释
|
||||||
|
@ -72,6 +72,7 @@ module.exports = {
|
||||||
// 如果用的是pnpm 不要配置这个,会有幽灵依赖的问题,访问不到很多模块
|
// 如果用的是pnpm 不要配置这个,会有幽灵依赖的问题,访问不到很多模块
|
||||||
// 查找第三方模块只在本项目的node_modules中查找
|
// 查找第三方模块只在本项目的node_modules中查找
|
||||||
modules: [path.resolve(__dirname, '../node_modules')],
|
modules: [path.resolve(__dirname, '../node_modules')],
|
||||||
|
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.join(__dirname, '../src')
|
'@': path.join(__dirname, '../src')
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
const { merge } = require('webpack-merge')
|
const { merge } = require('webpack-merge')
|
||||||
const baseConfig = require('./webpack.base.js')
|
const baseConfig = require('./webpack.base.js')
|
||||||
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||||||
|
|
||||||
// const VITE_BASE_URL = 'http://192.168.110.126:8099'; // 樊波
|
// const VITE_BASE_URL = 'http://192.168.110.126:8099'; // 樊波
|
||||||
const VITE_BASE_URL = 'http://120.55.12.245:8098'; // 测试-公网
|
const VITE_BASE_URL = 'http://120.55.12.245:8098'; // 测试-公网
|
||||||
|
@ -9,6 +11,23 @@ const VITE_BASE_URL = 'http://120.55.12.245:8098'; // 测试-公网
|
||||||
module.exports = merge(baseConfig, {
|
module.exports = merge(baseConfig, {
|
||||||
mode: 'development', // 开发模式,打包更加快速,省了代码优化步骤
|
mode: 'development', // 开发模式,打包更加快速,省了代码优化步骤
|
||||||
devtool: 'eval-cheap-module-source-map', // 源码调试模式
|
devtool: 'eval-cheap-module-source-map', // 源码调试模式
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
compress: {
|
||||||
|
// drop_console: true, // 移除所有的`console`语句
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
// comments: false, // 去掉注释
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// extractComments: false, // 不从代码中提取注释
|
||||||
|
}),
|
||||||
|
new CssMinimizerPlugin(),
|
||||||
|
],
|
||||||
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 8888, // 服务端口号
|
port: 8888, // 服务端口号
|
||||||
compress: false, // gzip压缩,开发环境不开启,提升热更新速度
|
compress: false, // gzip压缩,开发环境不开启,提升热更新速度
|
||||||
|
|
|
@ -2,6 +2,8 @@ const { merge } = require('webpack-merge')
|
||||||
const baseConfig = require('./webpack.base.js')
|
const baseConfig = require('./webpack.base.js')
|
||||||
const CompressionPlugin = require("compression-webpack-plugin");
|
const CompressionPlugin = require("compression-webpack-plugin");
|
||||||
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
||||||
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||||||
|
|
||||||
module.exports = merge(baseConfig, {
|
module.exports = merge(baseConfig, {
|
||||||
mode: 'production', // 生产模式,会开启 tree-shaking 和 压缩代码,以及其他优化
|
mode: 'production', // 生产模式,会开启 tree-shaking 和 压缩代码,以及其他优化
|
||||||
|
@ -20,6 +22,21 @@ module.exports = merge(baseConfig, {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimization: {
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
compress: {
|
||||||
|
drop_console: true, // 移除所有的`console`语句
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
comments: false, // 去掉注释
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extractComments: false, // 不从代码中提取注释
|
||||||
|
}),
|
||||||
|
new CssMinimizerPlugin(),
|
||||||
|
],
|
||||||
splitChunks: { // 分隔代码
|
splitChunks: { // 分隔代码
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
vendors: { // 提取node_modules 代码
|
vendors: { // 提取node_modules 代码
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.js",
|
"start": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.js",
|
||||||
"dev": "cross-env NODE_ENV=development webpack --config build/webpack.dev.js",
|
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.js",
|
||||||
"com": "cross-env NODE_ENV=production webpack --config build/webpack.com.js",
|
"com": "cross-env NODE_ENV=production webpack --config build/webpack.com.js"
|
||||||
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.js"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.5",
|
"axios": "^1.7.5",
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- 智能验证防刷 -->
|
<!-- 智能验证防刷 -->
|
||||||
<div id="captcha-element"></div>
|
<!-- <div id="captcha-element"></div>
|
||||||
<div id="captcha-button"></div>
|
<div id="captcha-button"></div> -->
|
||||||
<!-- 仅开发/测试使用 -->
|
<!-- 仅开发/测试使用 -->
|
||||||
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var vConsole = new window.VConsole();
|
var vConsole = new window.VConsole();
|
||||||
</script>
|
</script> -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"tests/**/*.ts",
|
"tests/**/*.ts",
|
||||||
"tests/**/*.tsx"
|
"tests/**/*.tsx",
|
||||||
|
"auto-imports.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
|
Loading…
Reference in New Issue