You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

webpack.config.js 2.1 KiB

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