webpack.config.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. },
  14. resolve: {
  15. extensions: ['.ts', '.js']
  16. },
  17. optimization: {
  18. minimize: false
  19. },
  20. devtool: 'source-map',
  21. module: {
  22. rules: [
  23. { test: /\.ts$/, use: ['ts-loader'] },
  24. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  25. { test: /\.md$/, use: 'raw-loader' },
  26. { test: /\.txt$/, use: 'raw-loader' },
  27. {
  28. test: /\.js$/,
  29. enforce: 'pre',
  30. use: ['source-map-loader']
  31. },
  32. { test: /\.(jpg|png|gif)$/, use: 'file-loader' },
  33. { test: /\.js.map$/, use: 'file-loader' },
  34. {
  35. test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
  36. use: 'url-loader?limit=10000&mimetype=application/font-woff'
  37. },
  38. {
  39. test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
  40. use: 'url-loader?limit=10000&mimetype=application/font-woff'
  41. },
  42. {
  43. test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  44. use: 'url-loader?limit=10000&mimetype=application/octet-stream'
  45. },
  46. {
  47. test: /\.otf(\?v=\d+\.\d+\.\d+)?$/,
  48. use: 'url-loader?limit=10000&mimetype=application/octet-stream'
  49. },
  50. { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: 'file-loader' },
  51. {
  52. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  53. issuer: /\.css$/,
  54. use: {
  55. loader: 'svg-url-loader',
  56. options: { encoding: 'none', limit: 10000 }
  57. }
  58. },
  59. {
  60. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  61. issuer: /\.js$/,
  62. use: {
  63. loader: 'raw-loader'
  64. }
  65. }
  66. ]
  67. },
  68. plugins: [
  69. new webpack.DefinePlugin({
  70. 'process.env': '{}',
  71. process: { cwd: () => '/' }
  72. })
  73. ]
  74. };