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.

116 lines
5.3KB

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