Commit 9ce2a4e5 by 冒粤蓉

add webpack.config

1 parent ff6f0371
...@@ -2,6 +2,7 @@ var path = require('path') ...@@ -2,6 +2,7 @@ var path = require('path')
var webpack = require('webpack') var webpack = require('webpack')
const { port } = require("../package"); const { port } = require("../package");
const htmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
...@@ -13,8 +14,8 @@ const templateFunction = require('./sprite') ...@@ -13,8 +14,8 @@ const templateFunction = require('./sprite')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
//localhost:10500 //localhost:10500
const IS_DEV_MODE = process.env.NODE_ENV !== 'production' const IS_DEV_MODE = process.env.NODE_ENV !== 'production'
const getPublicPath = IS_DEV_MODE ? '' : '/ots/vue/build/'; const getPublicPath = IS_DEV_MODE ? '' : './';
const resourcesPath = IS_DEV_MODE ? `//localhost:${port}` : 'http://eshield-perm.test.glsx.com.cn'; const resourcesPath = IS_DEV_MODE ? `//localhost:${port}` : 'http://e-shield-old.frontend.test.glsx.com.cn/';
module.exports = { module.exports = {
mode: IS_DEV_MODE ? 'development':'production', mode: IS_DEV_MODE ? 'development':'production',
...@@ -116,7 +117,11 @@ module.exports = { ...@@ -116,7 +117,11 @@ module.exports = {
], ],
}, },
plugins: [ plugins: [
new htmlWebpackPlugin({
chunks: ['main'],
filename: 'index.html',
template: path.resolve(__dirname, `../dist/index.html`)
}),
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
/*new SpritesmithPlugin({ /*new SpritesmithPlugin({
src: { src: {
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>v-simple</title> <title>试乘试驾</title>
</head> </head>
<!-- <link rel="stylesheet" href="css/main.5163fe9d199e8bbd0277.min.css"> -->
<body> <body>
<div id="glsx-sub-system"></div> <div id="glsx-sub-system"></div>
<script src="lib/pace.min.js"></script> <script src="lib/pace.min.js"></script>
<script src="lib/vue.min.js"></script> <script src="lib/vue.min.js"></script>
<script src="lib/element-ui.js"></script> <script src="lib/element-ui.js"></script>
<script src="lib/moment.min.js"></script> <script src="lib/moment.min.js"></script>
<script src="js/main.bundle.js"></script> <!-- <script src="js/main.5163fe9d199e8bbd0277.bundle.js"></script> -->
<!-- <script src="js/runtime.bundle.js"></script> --> <!-- <script src="js/runtime.bundle.js"></script> -->
</body> </body>
</html> </html>
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
"extract-text-webpack-plugin": "^3.0.2", "extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.4", "file-loader": "^1.1.4",
"hard-source-webpack-plugin": "^0.6.4", "hard-source-webpack-plugin": "^0.6.4",
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.18.0", "http-proxy-middleware": "^0.18.0",
"mini-css-extract-plugin": "^0.4.0", "mini-css-extract-plugin": "^0.4.0",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!