webpack.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
  2. const path = require('path');
  3. const webpack = require('webpack');
  4. module.exports = {
  5. entry: {
  6. 'viewer': './src/index.ts',
  7. //'viewer.min': './src/index.ts',
  8. },
  9. output: {
  10. path: path.resolve(__dirname, 'dist'),
  11. filename: '[name].js',
  12. libraryTarget: 'umd',
  13. library: 'Viewer3D',
  14. umdNamedDefine: true,
  15. devtoolModuleFilenameTemplate: '[absolute-resource-path]'
  16. },
  17. resolve: {
  18. extensions: ['.ts', '.tsx', '.js']
  19. },
  20. devtool: 'source-map',
  21. plugins: [
  22. new webpack.WatchIgnorePlugin([
  23. /\.d\.ts$/
  24. ]),
  25. /*new UglifyJSPlugin({
  26. uglifyOptions: {
  27. compress: {
  28. warnings: false,
  29. },
  30. output: {
  31. comments: false
  32. }
  33. },
  34. sourceMap: true,
  35. include: /\.min/,
  36. })*/
  37. ],
  38. module: {
  39. loaders: [{
  40. test: /\.tsx?$/,
  41. loader: 'ts-loader',
  42. exclude: /node_modules/
  43. },
  44. {
  45. test: /\.(html)$/,
  46. use: {
  47. loader: 'html-loader'
  48. }
  49. },
  50. {
  51. test: /\.(jpe?g|png|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
  52. use: 'base64-image-loader?limit=1000&name=[name].[ext]'
  53. }]
  54. },
  55. devServer: {
  56. contentBase: path.join(__dirname, "dist"),
  57. compress: true,
  58. //open: true,
  59. port: 9000
  60. }
  61. }