webpack.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. umdNamedDefine: true
  34. },
  35. externals: externals,
  36. plugins: plugins,
  37. loaders: [
  38. {
  39. test: /\.js$/,
  40. loader: "eslint-loader",
  41. include: "./dev/"
  42. }
  43. ],
  44. eslint: {
  45. configFile: './.eslintrc'
  46. },
  47. resolve: {
  48. modulesDirectories: ["bower_components"]
  49. }
  50. };