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 6.1KB

3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. 'jquery-ui-sortable': path.join(__dirname, 'node_modules/jquery-ui-sortable/jquery-ui.min.js'),
  21. 'adminlte-js': path.join(__dirname, 'node_modules/admin-lte/dist/js/adminlte.min.js'),
  22. 'adminlte-css': path.join(__dirname, 'node_modules/admin-lte/build/scss/adminlte.scss'),
  23. 'fontawesome-css': path.join(__dirname, 'node_modules/@fortawesome/fontawesome-free/css/all.css'),
  24. 'bootstrap': path.join(__dirname, 'node_modules/bootstrap/'),
  25. 'bootstrap-autocomplete': path.join(__dirname, 'node_modules/bootstrap-autocomplete/dist/latest/bootstrap-autocomplete.min.js'),
  26. 'select2': path.join(__dirname, 'node_modules/select2/dist/'),
  27. 'select2-bootstrap-theme': path.join(__dirname, 'node_modules/select2-bootstrap4-theme/dist/select2-bootstrap4.min.css'),
  28. 'toastr': path.join(__dirname, 'node_modules/toastr'),
  29. 'daterangepicker': path.join(__dirname, 'node_modules/bootstrap-daterangepicker'),
  30. 'moment': path.join(__dirname, 'node_modules/moment/dist/moment.js'),
  31. /*'adminlte': path.resolve(__dirname, './node_modules/admin-lte/dist/js/adminlte.min.js'),
  32. 'adminltePlugin': path.resolve(__dirname, './node_modules/admin-lte/plugins/'),
  33. 'admin-lte-css': path.resolve(__dirname, './node_modules/admin-lte/dist/css/adminlte.css'),
  34. 'core-js': path.resolve(__dirname, './node_modules/core-js'),
  35. 'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery'),
  36. 'select2': path.join(__dirname, 'node_modules/select2/dist/js/select2.js'),
  37. 'select2-css': path.join(__dirname, 'node_modules/select2/dist/css/select2.min.css'),*/
  38. //'select2-bootstrap-theme': path.join(__dirname, 'node_modules/select2-bootstrap-5-theme/dist/select2-bootstrap-5-theme.min.css')
  39. })
  40. /*
  41. * ENTRY CONFIG
  42. *
  43. * Each entry will result in one JavaScript file (e.g. app.js)
  44. * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
  45. */
  46. .addEntry('adminlte-plugins', './Lc/SovBundle/Resources/assets/app/adminlte/plugins/app.plugins.js')
  47. .addEntry('adminlte-index', './Lc/SovBundle/Resources/assets/app/adminlte/index/app.index.js')
  48. .addEntry('adminlte-form', './Lc/SovBundle/Resources/assets/app/adminlte/form/app.form.js')
  49. .addEntry('adminlte-sort', './Lc/SovBundle/Resources/assets/app/adminlte/sort/app.sort.js')
  50. .addEntry('adminlte-field-filemanager', './Lc/SovBundle/Resources/assets/app/adminlte/field/filemanager/app.filemanager.js')
  51. .addEntry('adminlte-field-collection', './Lc/SovBundle/Resources/assets/app/adminlte/field/collection/app.collection.js')
  52. .addEntry('adminlte-main', './Lc/SovBundle/Resources/assets/app/adminlte/main/app.main.js')
  53. .addEntry('sov-reminder', './Lc/SovBundle/Resources/assets/app/admin/reminder/app.reminder.js')
  54. .addEntry('sov-ticket', './Lc/SovBundle/Resources/assets/app/admin/ticket/app.ticket.js')
  55. .addEntry('app-backend', './assets/app/backend/common/app.common.js')
  56. .addEntry('app-frontend', './assets/app/frontend/app/app.common.js')
  57. .addEntry('app-bulle', './assets/app/frontend/js/bulle.js')
  58. // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
  59. .enableStimulusBridge('./assets/controllers.json')
  60. // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
  61. .splitEntryChunks()
  62. // will require an extra script tag for runtime.js
  63. // but, you probably want this, unless you're building a single-page app
  64. .enableSingleRuntimeChunk()
  65. /*
  66. * FEATURE CONFIG
  67. *
  68. * Enable & configure other features below. For a full
  69. * list of features, see:
  70. * https://symfony.com/doc/current/frontend.html#adding-more-features
  71. */
  72. .cleanupOutputBeforeBuild()
  73. .enableBuildNotifications()
  74. .enableSourceMaps(!Encore.isProduction())
  75. // enables hashed filenames (e.g. app.abc123.css)
  76. .enableVersioning()
  77. // .enableVersioning(Encore.isProduction())
  78. .configureBabel((config) => {
  79. config.plugins.push('@babel/plugin-proposal-class-properties');
  80. })
  81. // enables @babel/preset-env polyfills
  82. .configureBabelPresetEnv((config) => {
  83. config.useBuiltIns = 'usage';
  84. config.corejs = 3;
  85. })
  86. //ckeditor config
  87. .copyFiles([
  88. {from: './node_modules/ckeditor/', to: 'ckeditor/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: false},
  89. {from: './node_modules/ckeditor/adapters', to: 'ckeditor/adapters/[path][name].[ext]'},
  90. {from: './node_modules/ckeditor/lang', to: 'ckeditor/lang/[path][name].[ext]'},
  91. {from: './node_modules/ckeditor/plugins', to: 'ckeditor/plugins/[path][name].[ext]'},
  92. {from: './node_modules/ckeditor/skins', to: 'ckeditor/skins/[path][name].[ext]'},
  93. {from: './node_modules/ckeditor/vendor', to: 'ckeditor/vendor/[path][name].[ext]'}
  94. ])
  95. // uncomment if you use TypeScript
  96. // .enableTypeScriptLoader()
  97. // uncomment if you use React
  98. //.enableReactPreset()
  99. // uncomment to get integrity="..." attributes on your script & link tags
  100. // requires WebpackEncoreBundle 1.4 or higher
  101. //.enableIntegrityHashes(Encore.isProduction())
  102. // uncomment if you're having problems with a jQuery plugin
  103. //.autoProvidejQuery()
  104. ;
  105. module.exports = Encore.getWebpackConfig();