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.
 
 
 
 
 
 

50 lines
1.3 KiB

  1. var path = require('path');
  2. var webpack = require('webpack');
  3. var ExtractTextPlugin = require("extract-text-webpack-plugin");
  4. module.exports = {
  5. entry: {
  6. lesspass: "./src/lesspass"
  7. },
  8. output: {
  9. path: 'dist',
  10. publicPath: '/dist/',
  11. filename: '[name].js'
  12. },
  13. module: {
  14. loaders: [
  15. {test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/},
  16. {test: /\.json$/, loader: 'json-loader'},
  17. {test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")},
  18. {test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")},
  19. {
  20. test: /\.(png|jpg|gif|svg|woff2?|eot|ttf)(\?.*)?$/,
  21. loader: 'url-loader',
  22. query: {
  23. limit: 10000,
  24. name: '[name].[ext]?[hash]'
  25. }
  26. }
  27. ]
  28. },
  29. plugins: [
  30. new ExtractTextPlugin("[name].css")
  31. ],
  32. devtool: '#eval-source-map'
  33. };
  34. if (process.env.NODE_ENV === 'production') {
  35. module.exports.devtool = '#source-map';
  36. module.exports.plugins = (module.exports.plugins || []).concat([
  37. new webpack.DefinePlugin({
  38. 'process.env': {
  39. NODE_ENV: '"production"'
  40. }
  41. }),
  42. new webpack.optimize.UglifyJsPlugin({
  43. output: {comments: false},
  44. compress: {warnings: false}
  45. }),
  46. new webpack.optimize.OccurenceOrderPlugin()
  47. ]);
  48. }