webpack.config.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright (c) Jupyter Development Team.
  2. // Copyright (c) Bloomberg Finance LP.
  3. // Distributed under the terms of the Modified BSD License.
  4. const path = require('path');
  5. const webpack = require('webpack');
  6. module.exports = {
  7. entry: './src/inpage/index.ts',
  8. target: 'web',
  9. output: {
  10. path: path.resolve(__dirname, 'lib/lib-inpage'),
  11. filename: 'inpage.js',
  12. publicPath: '/',
  13. hashFunction: 'sha256'
  14. },
  15. resolve: {
  16. extensions: ['.ts', '.js']
  17. },
  18. optimization: {
  19. minimize: false
  20. },
  21. devtool: 'source-map',
  22. module: {
  23. rules: [
  24. { test: /\.ts$/, use: ['ts-loader'] },
  25. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  26. { test: /\.md$/, use: 'raw-loader' },
  27. { test: /\.txt$/, use: 'raw-loader' },
  28. {
  29. test: /\.js$/,
  30. enforce: 'pre',
  31. use: ['source-map-loader']
  32. },
  33. { test: /\.(jpg|png|gif)$/, use: 'file-loader' },
  34. { test: /\.js.map$/, use: 'file-loader' },
  35. {
  36. test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
  37. use: 'url-loader?limit=10000&mimetype=application/font-woff'
  38. },
  39. {
  40. test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
  41. use: 'url-loader?limit=10000&mimetype=application/font-woff'
  42. },
  43. {
  44. test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  45. use: 'url-loader?limit=10000&mimetype=application/octet-stream'
  46. },
  47. {
  48. test: /\.otf(\?v=\d+\.\d+\.\d+)?$/,
  49. use: 'url-loader?limit=10000&mimetype=application/octet-stream'
  50. },
  51. { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: 'file-loader' },
  52. {
  53. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  54. issuer: /\.css$/,
  55. use: {
  56. loader: 'svg-url-loader',
  57. options: { encoding: 'none', limit: 10000 }
  58. }
  59. },
  60. {
  61. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  62. issuer: /\.js$/,
  63. use: {
  64. loader: 'raw-loader'
  65. }
  66. }
  67. ]
  68. },
  69. plugins: [
  70. new webpack.DefinePlugin({
  71. 'process.env': '{}',
  72. process: { cwd: () => '/' }
  73. })
  74. ]
  75. };