webpack.config.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var path = require('path');
  2. var webpack = require('webpack');
  3. module.exports = {
  4. entry: {
  5. 'osmd': './src/OSMD/OSMD.ts', // Main library
  6. 'demo': './demo/index.js' // Demo index
  7. },
  8. output: {
  9. path: path.resolve(__dirname, 'build'),
  10. filename: '[name].js',
  11. },
  12. resolve: {
  13. // Add '.ts' and '.tsx' as a resolvable extension.
  14. extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
  15. },
  16. module: {
  17. loaders: [
  18. // all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
  19. { test: /\.tsx?$/, loader: 'ts-loader' },
  20. // all files with a '.js' extension. Mostly for the web demo.
  21. { test: /\.jsx?$/, loader: 'babel-loader', exclude: /(node_modules|bower_components)/,
  22. query: {
  23. presets: ['es2015']
  24. }
  25. },
  26. ]
  27. },
  28. plugins: [
  29. // build optimization plugins
  30. new webpack.LoaderOptionsPlugin({
  31. minimize: true,
  32. debug: true
  33. }),
  34. new webpack.ProvidePlugin({
  35. $: 'jquery',
  36. jQuery: 'jquery'
  37. }),
  38. // FIXME: use environment variable to control uglify.
  39. // new webpack.optimize.UglifyJsPlugin({
  40. // warnings: false,
  41. // beautify: false,
  42. // compress: true,
  43. // comments: false,
  44. // sourceMap: true
  45. // })
  46. ],
  47. devServer: {
  48. contentBase: [
  49. path.join(__dirname, 'test/data'),
  50. path.join(__dirname, 'build'),
  51. path.join(__dirname, 'demo')
  52. // TODO: fill in paths for demo data
  53. ],
  54. port: 8000,
  55. compress: false,
  56. },
  57. };