mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-27 10:43:45 +00:00
add version build
This commit is contained in:
+33
-26
@@ -1,14 +1,17 @@
|
||||
const path = require('path')
|
||||
const { version } = require('./package.json')
|
||||
|
||||
const svgSpriteDirs = [
|
||||
path.resolve(__dirname, 'src/svg/'),
|
||||
require.resolve('antd').replace(/index\.js$/, ''),
|
||||
require.resolve('antd').replace(/index\.js$/, '')
|
||||
]
|
||||
|
||||
export default {
|
||||
entry: 'src/index.js',
|
||||
svgSpriteLoaderDirs: svgSpriteDirs,
|
||||
"theme": "./theme.config.js",
|
||||
entry : 'src/index.js',
|
||||
svgSpriteLoaderDirs : svgSpriteDirs,
|
||||
theme : "./theme.config.js",
|
||||
publicPath : `/${version}/`,
|
||||
outputPath : `./dist/${version}/`,
|
||||
// 接口代理示例
|
||||
// "proxy": {
|
||||
// "/api/v1": {
|
||||
@@ -22,29 +25,33 @@ export default {
|
||||
// "pathRewrite": { "^/api/v2" : "/api/v2" }
|
||||
// }
|
||||
// },
|
||||
"env": {
|
||||
"development": {
|
||||
"extraBabelPlugins": [
|
||||
"dva-hmr",
|
||||
"transform-runtime",
|
||||
["import", { "libraryName": "antd", "style": true }]
|
||||
env : {
|
||||
development: {
|
||||
extraBabelPlugins: [
|
||||
"dva-hmr",
|
||||
"transform-runtime",
|
||||
[
|
||||
"import", {
|
||||
"libraryName": "antd",
|
||||
"style": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"production": {
|
||||
"extraBabelPlugins": [
|
||||
"transform-runtime",
|
||||
["import", { "libraryName": "antd", "style": true}]
|
||||
]
|
||||
},
|
||||
production: {
|
||||
extraBabelPlugins: [
|
||||
"transform-runtime",
|
||||
[
|
||||
"import", {
|
||||
"libraryName": "antd",
|
||||
"style": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dllPlugin": {
|
||||
"exclude": [
|
||||
"babel-runtime"
|
||||
],
|
||||
"include": [
|
||||
"dva/router",
|
||||
"dva/saga",
|
||||
"dva/fetch",
|
||||
]
|
||||
}
|
||||
dllPlugin : {
|
||||
exclude: ["babel-runtime"],
|
||||
include: ["dva/router", "dva/saga", "dva/fetch"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "antd-admin",
|
||||
"version": "4.3.0",
|
||||
"dependencies": {
|
||||
"antd": "^2.11.2",
|
||||
"axios": "^0.16.2",
|
||||
@@ -9,6 +11,7 @@
|
||||
"draftjs-to-markdown": "^0.4.0",
|
||||
"dva": "^1.2.0",
|
||||
"dva-loading": "^0.2.0",
|
||||
"ejs-loader": "^0.3.0",
|
||||
"jsonp": "^0.2.1",
|
||||
"less-vars-to-js": "^1.1.2",
|
||||
"lodash": "^4.17.4",
|
||||
@@ -41,6 +44,8 @@
|
||||
"eslint-plugin-import": "^2.6.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.2",
|
||||
"eslint-plugin-react": "^7.1.0",
|
||||
"html-webpack-plugin": "^2.29.0",
|
||||
"html-webpack-template": "^5.6.0",
|
||||
"redbox-react": "^1.2.10",
|
||||
"roadhog": "1.0.0-beta.7"
|
||||
},
|
||||
|
||||
+32
-1
@@ -1,6 +1,8 @@
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const HtmlWebpackTemplate = require('html-webpack-template')
|
||||
|
||||
module.exports = (webpackConfig, env) => {
|
||||
// FilenameHash
|
||||
// https://webpack.js.org/configuration/output/#output-chunkfilename
|
||||
webpackConfig.output.chunkFilename = '[name].[hash].js'
|
||||
|
||||
if (env === 'production' && webpackConfig.module) {
|
||||
@@ -25,6 +27,35 @@ module.exports = (webpackConfig, env) => {
|
||||
// loader: 'eslint',
|
||||
// }]
|
||||
|
||||
|
||||
webpackConfig.plugins = webpackConfig.plugins.concat([
|
||||
new HtmlWebpackPlugin({
|
||||
hash: true,
|
||||
mobile: true,
|
||||
title: 'antd-admin',
|
||||
inject: false,
|
||||
appMountId: 'root',
|
||||
template: `!!ejs!${HtmlWebpackTemplate}`,
|
||||
filename: env === 'production' ? '../index.html' : 'index.html',
|
||||
minify: {
|
||||
collapseWhitespace: true,
|
||||
},
|
||||
scripts: env === 'production' ? null : [
|
||||
'roadhog.dll.js',
|
||||
],
|
||||
meta: [
|
||||
{
|
||||
name: 'description',
|
||||
content: 'A admin dashboard application demo built upon Ant Design and Dva.js',
|
||||
},
|
||||
{
|
||||
name: 'viewport',
|
||||
content: 'width=device-width, initial-scale=1.0',
|
||||
},
|
||||
],
|
||||
}),
|
||||
])
|
||||
|
||||
// Alias
|
||||
webpackConfig.resolve.alias = {
|
||||
components: `${__dirname}/src/components`,
|
||||
|
||||
Reference in New Issue
Block a user