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.

52 lines
1.7 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. 'sequence_labeling': './static/js/sequence_labeling.js',
  10. 'document_classification': './static/js/document_classification.js',
  11. 'seq2seq': './static/js/seq2seq.js',
  12. 'projects': './static/js/projects.js',
  13. 'stats': './static/js/stats.js',
  14. 'label': './static/js/label.js',
  15. 'guideline': './static/js/guideline.js',
  16. 'demo_text_classification': './static/js/demo/demo_text_classification.js',
  17. 'demo_named_entity': './static/js/demo/demo_named_entity.js',
  18. 'demo_translation': './static/js/demo/demo_translation.js',
  19. 'upload': './static/js/upload.js',
  20. 'dataset': './static/js/dataset.js',
  21. },
  22. output: {
  23. publicPath: hotReload ? 'http://localhost:8080/' : '',
  24. path: __dirname + '/static/bundle',
  25. filename: '[name].js'
  26. },
  27. devtool: devMode ? 'cheap-eval-source-map' : 'source-map',
  28. devServer: {
  29. hot: true,
  30. quiet: false,
  31. headers: { 'Access-Control-Allow-Origin': '*' }
  32. },
  33. module: {
  34. rules: [
  35. {
  36. test: /\.vue$/,
  37. loader: 'vue-loader'
  38. }
  39. ]
  40. },
  41. plugins: [
  42. new BundleTracker({ filename: './webpack-stats.json' }),
  43. new VueLoaderPlugin()
  44. ],
  45. resolve: {
  46. extensions: ['.js', '.vue'],
  47. alias: {
  48. vue$: 'vue/dist/vue.esm.js',
  49. },
  50. },
  51. }