You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.4 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. const process = require('process');
  2. const BundleTracker = require('webpack-bundle-tracker');
  3. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  4. const devMode = process.env.DEBUG !== 'False';
  5. const hotReload = process.env.HOT_RELOAD === '1';
  6. module.exports = {
  7. mode: devMode ? 'development' : 'production',
  8. entry: {
  9. 'index': './static/js/index.js',
  10. 'sequence_labeling': './static/js/sequence_labeling.js',
  11. 'document_classification': './static/js/document_classification.js',
  12. 'seq2seq': './static/js/seq2seq.js',
  13. 'projects': './static/js/projects.js',
  14. 'stats': './static/js/stats.js',
  15. 'label': './static/js/label.js',
  16. 'guideline': './static/js/guideline.js',
  17. 'demo_text_classification': './static/js/demo/demo_text_classification.js',
  18. 'demo_named_entity': './static/js/demo/demo_named_entity.js',
  19. 'demo_translation': './static/js/demo/demo_translation.js',
  20. 'upload_seq2seq': './static/js/upload_seq2seq.js',
  21. 'upload_sequence_labeling': './static/js/upload_sequence_labeling.js',
  22. 'upload_text_classification': './static/js/upload_text_classification.js',
  23. 'download_seq2seq': './static/js/download_seq2seq.js',
  24. 'download_sequence_labeling': './static/js/download_sequence_labeling.js',
  25. 'download_text_classification': './static/js/download_text_classification.js',
  26. },
  27. output: {
  28. publicPath: hotReload ? 'http://localhost:8080/' : '',
  29. path: __dirname + '/static/bundle',
  30. filename: '[name].js'
  31. },
  32. devtool: devMode ? 'cheap-eval-source-map' : 'source-map',
  33. devServer: {
  34. hot: true,
  35. quiet: false,
  36. headers: { 'Access-Control-Allow-Origin': '*' }
  37. },
  38. module: {
  39. rules: [
  40. {
  41. test: /\.pug$/,
  42. loader: 'pug-plain-loader'
  43. },
  44. {
  45. test: /\.css$/,
  46. use: [
  47. 'vue-style-loader',
  48. 'css-loader'
  49. ]
  50. },
  51. {
  52. test: /\.vue$/,
  53. loader: 'vue-loader'
  54. }
  55. ]
  56. },
  57. plugins: [
  58. new BundleTracker({ filename: './webpack-stats.json' }),
  59. new VueLoaderPlugin()
  60. ],
  61. resolve: {
  62. extensions: ['.js', '.vue'],
  63. alias: {
  64. vue$: 'vue/dist/vue.esm.js',
  65. },
  66. },
  67. }