webpack.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "use strict";
  2. const webpack = require("webpack");
  3. const fs = require("fs");
  4. const args = process.argv;
  5. let plugins = [
  6. new webpack.BannerPlugin(fs.readFileSync('./dev/banner.txt', 'utf8'), { raw: true, entryOnly: true })
  7. ];
  8. let externals = [];
  9. let filename = "raphael";
  10. if(args.indexOf('--no-deps') !== -1){
  11. console.log('Building version without deps');
  12. externals.push("eve");
  13. filename += ".no-deps"
  14. }
  15. if(args.indexOf('--min') !== -1){
  16. console.log('Building minified version');
  17. plugins.push(
  18. new webpack.optimize.UglifyJsPlugin({
  19. compress:{
  20. dead_code: false,
  21. unused: false
  22. }
  23. })
  24. );
  25. filename += ".min"
  26. }
  27. module.exports = {
  28. entry: './dev/raphael.amd.js',
  29. output: {
  30. filename: filename + ".js",
  31. libraryTarget: "umd",
  32. library: "Raphael"
  33. },
  34. externals: externals,
  35. plugins: plugins,
  36. loaders: [
  37. {
  38. test: /\.js$/,
  39. loader: "eslint-loader",
  40. include: "./dev/"
  41. }
  42. ],
  43. eslint: {
  44. configFile: './.eslintrc'
  45. },
  46. resolve: {
  47. modulesDirectories: ["bower_components"]
  48. }
  49. };