25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.8 KiB

  1. const webpack = require('webpack');
  2. const path = require('path');
  3. const ExtractTextPlugin = require('extract-text-webpack-plugin');
  4. const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  5. module.exports = {
  6. entry: {
  7. app: './src/main.js',
  8. },
  9. output: {
  10. path: path.resolve(__dirname, './dist'),
  11. publicPath: '/dist/',
  12. filename: 'lesspass.min.js'
  13. },
  14. module: {
  15. rules: [
  16. {test: /\.vue$/, loader: 'vue-loader'},
  17. {test: /\.js$/, include: [path.resolve(__dirname, './src')], loader: 'babel-loader'},
  18. {test: /\.json/, loader: 'json-loader'},
  19. {test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]'},
  20. {test: /\.scss$/, loader: ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader!sass-loader', publicPath: ''})},
  21. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  22. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  23. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/octet-stream'},
  24. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'},
  25. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=image/svg+xml'},
  26. ]
  27. },
  28. plugins: [
  29. new ExtractTextPlugin('lesspass.min.css')
  30. ]
  31. };
  32. if (process.env.NODE_ENV === 'production') {
  33. module.exports.devtool = false;
  34. module.exports.plugins = (module.exports.plugins || []).concat([
  35. new OptimizeCssAssetsPlugin(),
  36. new webpack.optimize.UglifyJsPlugin({
  37. output: {comments: false},
  38. compress: {warnings: false}
  39. })
  40. ]);
  41. }