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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. Encore
  8. // directory where compiled assets will be stored
  9. .setOutputPath('Resources/public/build/')
  10. // public path used by the web server to access the output path
  11. .setPublicPath('/build')
  12. // only needed for CDN's or sub-directory deploy
  13. //.setManifestKeyPrefix('build/')
  14. .enableSassLoader()
  15. /*
  16. * ENTRY CONFIG
  17. *
  18. * Add 1 entry for each "page" of your app
  19. * (including one that's included on every page - e.g. "app")
  20. *
  21. * Each entry will result in one JavaScript file (e.g. app.js)
  22. * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
  23. */
  24. .addEntry('backend-common', './Resources/assets/apps/backend/common/app.common.js')
  25. //.addEntry('page1', './assets/page1.js')
  26. //.addEntry('page2', './assets/page2.js')
  27. // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
  28. .splitEntryChunks()
  29. // will require an extra script tag for runtime.js
  30. // but, you probably want this, unless you're building a single-page app
  31. .enableSingleRuntimeChunk()
  32. /*
  33. * FEATURE CONFIG
  34. *
  35. * Enable & configure other features below. For a full
  36. * list of features, see:
  37. * https://symfony.com/doc/current/frontend.html#adding-more-features
  38. */
  39. .cleanupOutputBeforeBuild()
  40. .enableBuildNotifications()
  41. .enableSourceMaps(!Encore.isProduction())
  42. // enables hashed filenames (e.g. app.abc123.css)
  43. .enableVersioning(Encore.isProduction())
  44. // enables @babel/preset-env polyfills
  45. .configureBabelPresetEnv((config) => {
  46. config.useBuiltIns = 'usage';
  47. config.corejs = 3;
  48. })
  49. // enables Sass/SCSS support
  50. //.enableSassLoader()
  51. // uncomment if you use TypeScript
  52. //.enableTypeScriptLoader()
  53. // uncomment to get integrity="..." attributes on your script & link tags
  54. // requires WebpackEncoreBundle 1.4 or higher
  55. //.enableIntegrityHashes(Encore.isProduction())
  56. // uncomment if you're having problems with a jQuery plugin
  57. //.autoProvidejQuery()
  58. // uncomment if you use API Platform Admin (composer require api-admin)
  59. //.enableReactPreset()
  60. //.addEntry('admin', './assets/admin.js')
  61. ;
  62. module.exports = Encore.getWebpackConfig();