|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- const path = require('path')
- const ExtractTextPlugin = require('extract-text-webpack-plugin')
- const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
- const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
-
- module.exports = {
- entry: './src/index.js',
- output: {
- filename: 'vue-selectl.js',
- path: path.resolve(__dirname, 'dist'),
- library: 'VueSelectl',
- libraryTarget: 'umd',
- umdNamedDefine: true
- },
- resolve: {
- extensions: ['.js', '.vue', '.styl'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js'
- }
- },
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: {
- extractCSS: true
- }
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- exclude: /node_modules/
- },
- {
- test: /\.(styl|css)$/,
- loader: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: [
- {
- loader: 'css-loader',
- options: {
- minimize: true
- }
- },
- 'stylus-loader'
- ]})
- },
- {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: '[name].[ext]'
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- use: [
- {
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: '[name].[ext]'
- }
- }
- ]
- }
- ]
- },
- externals: {
- vue: 'vue'
- },
- plugins: [
- new ExtractTextPlugin('styles.css'),
- new UglifyJSPlugin({
- uglifyOptions: {
- compress: {
- warnings: false,
- drop_console: true,
- drop_debugger: false
- }
- }
- }),
- new OptimizeCssAssetsPlugin({
- assetNameRegExp: /\.css$/g,
- cssProcessor: require('cssnano'),
- cssProcessorOptions: { discardComments: { removeAll: true } },
- canPrint: true
- })
- ]
- }
|