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

webpack.config.js 1.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. const CopyWebpackPlugin = require('copy-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. module: {
  16. rules: [
  17. {test: /\.vue$/, loader: 'vue-loader'},
  18. {test: /\.js$/, include: [path.resolve(__dirname, './src')], loader: 'babel-loader'},
  19. {test: /\.json/, loader: 'json-loader'},
  20. {test: /\.(png|jpg|jpeg|gif)$/, loader: 'file-loader?name=[name].[ext]'},
  21. {test: /\.scss$/, loader: ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader!sass-loader', publicPath: ''})},
  22. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  23. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/font-woff'},
  24. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=application/octet-stream'},
  25. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'},
  26. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=8192&mimetype=image/svg+xml'},
  27. ]
  28. },
  29. plugins: [
  30. new ExtractTextPlugin('lesspass.min.css'),
  31. new CopyWebpackPlugin([{context: './src/i18n', from: '**/*.json', to: 'i18n'}])
  32. ]
  33. };
  34. if (process.env.NODE_ENV === 'production') {
  35. module.exports.devtool = false;
  36. module.exports.plugins = (module.exports.plugins || []).concat([
  37. new OptimizeCssAssetsPlugin()
  38. ]);
  39. }