Commit d57b8b96 authored by 何虹's avatar 何虹 💬

打包

parent d16ea9c8
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"lib/*" "lib/*"
], ],
"scripts": { "scripts": {
"build1": "cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.js",
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
...@@ -29,6 +30,7 @@ ...@@ -29,6 +30,7 @@
"moment": "^2.24.0", "moment": "^2.24.0",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"sortablejs": "^1.12.0", "sortablejs": "^1.12.0",
"style-loader": "^2.0.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-video-player": "^5.0.2", "vue-video-player": "^5.0.2",
"xlsx": "^0.16.9" "xlsx": "^0.16.9"
...@@ -46,7 +48,9 @@ ...@@ -46,7 +48,9 @@
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0", "eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"less": "^3.12.2", "extract-text-webpack-plugin": "^4.0.0-beta.0",
"less": "^3.13.0",
"less-loader": "^7.1.0",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
} }
} }
var path = require('path')
var webpack = require('webpack')
const ExtractTextPlugin = require ('extract-text-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
entry: {
'hs-sky-ui': './src/packages/index.js'
},
output: {
path: path.resolve(__dirname, './lib'),
publicPath: '/lib/',
filename: '[name].js',
library: 'hs-sky-ui',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.less$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "less-loader" // compiles Less to CSS
}]
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'vue-style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': path.resolve(__dirname, './src')
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map',
optimization: {
minimizer: [
new TerserPlugin({
cache: true, // 开启缓存
parallel: true, // 支持多进程
sourceMap: true,
}),
]
},
plugins:[new VueLoaderPlugin()]
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new ExtractTextPlugin("index.css",{allChunks: true}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
// new webpack.optimize.UglifyJsPlugin({
// sourceMap: true,
// compress: {
// warnings: false
// }
// }),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment