Merge pull request #552 from zuiidea/develop

add entry.ejs and add lte IE10 polyfill
This commit is contained in:
zuiidea
2017-09-06 09:56:25 +08:00
committed by GitHub
3 changed files with 35 additions and 26 deletions
+3 -5
View File
@@ -27,8 +27,7 @@
"react-dom": "^15.6.1",
"react-draft-wysiwyg": "^1.10.0",
"react-helmet": "^5.1.3",
"recharts": "^0.22.4",
"roadhog": "^1.2.1"
"recharts": "^0.22.4"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
@@ -48,9 +47,8 @@
"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"
"roadhog": "^1.2.1"
},
"pre-commit": ["lint"],
"scripts": {
@@ -60,4 +58,4 @@
"build:dll": "roadhog buildDll",
"build:new": "node version && roadhog build"
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<% htmlWebpackPlugin.options.headScripts = htmlWebpackPlugin.options.headScripts || [] %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="A admin dashboard application demo built upon Ant Design and Dva.js">
<title>antd admin</title>
<!--[if lte IE 10]>
<script
src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,media-match/2.0.2/media.match.min.js"></script>
<![endif]-->
<% for (item of htmlWebpackPlugin.options.headScripts) { %>
<script src="<%= item %>"></script>
<% } %>
</head>
<body>
<div id="root"></div>
</body>
</html>
+7 -21
View File
@@ -1,18 +1,17 @@
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackTemplate = require('html-webpack-template')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
module.exports = (webpackConfig, env) => {
const production = env === 'production'
// FilenameHash
webpackConfig.output.chunkFilename = '[name].[hash].js'
webpackConfig.output.chunkFilename = '[name].[chunkhash].js'
if (production) {
if (webpackConfig.module) {
// ClassnameHash
webpackConfig.module.rules.map((item) => {
if (String(item.test) === '/\\.less$/' || item.test === '/\\.css/') {
if (String(item.test) === '/\\.less$/' || String(item.test) === '/\\.css/') {
item.use.filter(iitem => iitem.loader === 'css')[0].options.localIdentName = '[hash:base64:5]'
}
return item
@@ -34,26 +33,13 @@ module.exports = (webpackConfig, env) => {
},
]),
new HtmlWebpackPlugin({
hash: true,
mobile: true,
title: 'antd-admin',
inject: false,
appMountId: 'root',
template: `!!ejs-loader!${HtmlWebpackTemplate}`,
template: `${__dirname}/src/entry.ejs`,
filename: production ? '../index.html' : 'index.html',
minify: {
minify: production ? {
collapseWhitespace: true,
},
scripts: 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',
},
],
} : null,
hash: true,
headScripts: production ? null : ['/roadhog.dll.js'],
}),
])