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.

webpack.config.js 5.4KB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. const Encore = require('@symfony/webpack-encore');
  2. // Manually configure the runtime environment if not already configured yet by the "encore" command.
  3. // It's useful when you use tools that rely on webpack.config.js file.
  4. if (!Encore.isRuntimeEnvironmentConfigured()) {
  5. Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
  6. }
  7. const path = require('path');
  8. Encore
  9. // directory where compiled assets will be stored
  10. .setOutputPath('public/build/')
  11. // public path used by the web server to access the output path
  12. .setPublicPath('/build')
  13. // only needed for CDN's or sub-directory deploy
  14. //.setManifestKeyPrefix('build/')
  15. .enableSassLoader()
  16. .addAliases({
  17. 'core-js': path.join(__dirname, 'node_modules/core-js'),
  18. 'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery'),
  19. 'jquery-ui': path.join(__dirname, 'node_modules/jquery-ui-dist/jquery-ui'),
  20. 'adminlte-js': path.join(__dirname, 'node_modules/admin-lte/dist/js/adminlte.min.js'),
  21. 'adminlte-css': path.join(__dirname, 'node_modules/admin-lte/build/scss/adminlte.scss'),
  22. 'fontawesome-css': path.join(__dirname, 'node_modules/@fortawesome/fontawesome-free/css/all.css'),
  23. 'bootstrap': path.join(__dirname, 'node_modules/bootstrap/'),
  24. 'bootstrap-autocomplete': path.join(__dirname, 'node_modules/bootstrap-autocomplete/dist/latest/bootstrap-autocomplete.min.js'),
  25. 'select2': path.join(__dirname, 'node_modules/select2/dist/'),
  26. 'select2-bootstrap4-theme': path.join(__dirname, 'node_modules/select2-bootstrap4-theme/dist/select2-bootstrap4.min.css'),
  27. 'toastr': path.join(__dirname, 'node_modules/toastr'),
  28. 'daterangepicker': path.join(__dirname, 'node_modules/bootstrap-daterangepicker'),
  29. 'moment': path.join(__dirname, 'node_modules/moment/dist/moment.js'),
  30. /*'adminlte': path.resolve(__dirname, './node_modules/admin-lte/dist/js/adminlte.min.js'),
  31. 'adminltePlugin': path.resolve(__dirname, './node_modules/admin-lte/plugins/'),
  32. 'admin-lte-css': path.resolve(__dirname, './node_modules/admin-lte/dist/css/adminlte.css'),
  33. 'core-js': path.resolve(__dirname, './node_modules/core-js'),
  34. 'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery'),
  35. 'select2': path.join(__dirname, 'node_modules/select2/dist/js/select2.js'),
  36. 'select2-css': path.join(__dirname, 'node_modules/select2/dist/css/select2.min.css'),*/
  37. //'select2-bootstrap-theme': path.join(__dirname, 'node_modules/select2-bootstrap-5-theme/dist/select2-bootstrap-5-theme.min.css')
  38. })
  39. /*
  40. * ENTRY CONFIG
  41. *
  42. * Each entry will result in one JavaScript file (e.g. app.js)
  43. * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
  44. */
  45. .addEntry('adminlte-plugins', './Lc/SovBundle/Resources/assets/app/adminlte/plugins/app.plugins.js')
  46. .addEntry('adminlte-index', './Lc/SovBundle/Resources/assets/app/adminlte/index/app.index.js')
  47. .addEntry('adminlte-form', './Lc/SovBundle/Resources/assets/app/adminlte/form/app.form.js')
  48. .addEntry('adminlte-sort', './Lc/SovBundle/Resources/assets/app/adminlte/sort/app.sort.js')
  49. .addEntry('adminlte-field-filemanager', './Lc/SovBundle/Resources/assets/app/adminlte/field/filemanager/app.filemanager.js')
  50. .addEntry('adminlte-field-collection', './Lc/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js')
  51. .addEntry('adminlte-main', './Lc/SovBundle/Resources/assets/app/adminlte/main/app.main.js')
  52. .addEntry('sov-reminder', './Lc/SovBundle/Resources/assets/app/admin/reminder/app.reminder.js')
  53. .addEntry('sov-ticket', './Lc/SovBundle/Resources/assets/app/admin/ticket/app.ticket.js')
  54. .addEntry('app-backend', './assets/app/backend/common/app.common.js')
  55. .addEntry('app-frontend', './assets/app/frontend/app/app.common.js')
  56. // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
  57. .enableStimulusBridge('./assets/controllers.json')
  58. // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
  59. .splitEntryChunks()
  60. // will require an extra script tag for runtime.js
  61. // but, you probably want this, unless you're building a single-page app
  62. .enableSingleRuntimeChunk()
  63. /*
  64. * FEATURE CONFIG
  65. *
  66. * Enable & configure other features below. For a full
  67. * list of features, see:
  68. * https://symfony.com/doc/current/frontend.html#adding-more-features
  69. */
  70. .cleanupOutputBeforeBuild()
  71. .enableBuildNotifications()
  72. .enableSourceMaps(!Encore.isProduction())
  73. // enables hashed filenames (e.g. app.abc123.css)
  74. .enableVersioning()
  75. // .enableVersioning(Encore.isProduction())
  76. .configureBabel((config) => {
  77. config.plugins.push('@babel/plugin-proposal-class-properties');
  78. })
  79. // enables @babel/preset-env polyfills
  80. .configureBabelPresetEnv((config) => {
  81. config.useBuiltIns = 'usage';
  82. config.corejs = 3;
  83. })
  84. // enables Sass/SCSS support
  85. //.enableSassLoader()
  86. // uncomment if you use TypeScript
  87. //.enableTypeScriptLoader()
  88. // uncomment if you use React
  89. //.enableReactPreset()
  90. // uncomment to get integrity="..." attributes on your script & link tags
  91. // requires WebpackEncoreBundle 1.4 or higher
  92. //.enableIntegrityHashes(Encore.isProduction())
  93. // uncomment if you're having problems with a jQuery plugin
  94. //.autoProvidejQuery()
  95. ;
  96. module.exports = Encore.getWebpackConfig();