123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- const path = require('path');
- const webpack = require('webpack');
- const ProgressBarPlugin = require('progress-bar-webpack-plugin');
- const config = require('./config');
- module.exports = {
- entry: {
- app: ['./src/index.js']
- },
- output: {
- path: path.resolve(process.cwd(), './lib'),
- publicPath: '/dist/',
- filename: 'index.js',
- chunkFilename: '[id].js',
- libraryTarget: 'umd',
- library: 'ELEMENT',
- umdNamedDefine: true
- },
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: config.alias
- },
- externals: {
- vue: config.vue
- },
- module: {
- rules: [
- {
- test: /\.(jsx?|babel|es6)$/,
- include: process.cwd(),
- exclude: config.jsexclude,
- loader: 'babel-loader'
- },
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: {
- preserveWhitespace: false
- }
- },
- {
- test: /\.json$/,
- loader: 'json-loader'
- },
- {
- test: /\.css$/,
- loaders: ['style-loader', 'css-loader', 'postcss-loader']
- },
- {
- test: /\.scss$/,
- loaders: ['style-loader', 'css-loader', 'sass-loader']
- },
- {
- test: /\.html$/,
- loader: 'html-loader?minimize=false'
- },
- {
- test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: path.posix.join('static', '[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.svg(\?\S*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: path.posix.join('static', '[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(gif|png|jpe?g)(\?\S*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: path.posix.join('static', '[name].[hash:7].[ext]')
- }
- }
- ]
- },
- plugins: [
- new ProgressBarPlugin(),
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify('production')
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- },
- output: {
- comments: false
- },
- sourceMap: false
- }),
- new webpack.LoaderOptionsPlugin({
- minimize: true
- })
- ]
- };
|