1
|
|
|
let Encore = require('@symfony/webpack-encore'); |
2
|
|
|
|
3
|
|
|
Encore |
4
|
|
|
// directory where compiled assets will be stored |
5
|
|
|
.setOutputPath('./public/build/') |
6
|
|
|
// public path used by the web server to access the output path |
7
|
|
|
.setPublicPath(Encore.isDev() ? '/build/' : 'build/') |
8
|
|
|
// only needed for CDN's or sub-directory deploy |
9
|
|
|
//.setManifestKeyPrefix('build/') |
10
|
|
|
|
11
|
|
|
// Set up global variables. |
12
|
|
|
.autoProvideVariables({ |
13
|
|
|
jQuery: 'jquery', |
14
|
|
|
$: 'jquery' |
15
|
|
|
}) |
16
|
|
|
|
17
|
|
|
/* |
18
|
|
|
* ENTRY CONFIG |
19
|
|
|
* |
20
|
|
|
* Add 1 entry for each "page" of your app |
21
|
|
|
* (including one that's included on every page - e.g. "app") |
22
|
|
|
* |
23
|
|
|
* Each entry will result in one JavaScript file (e.g. app.js) |
24
|
|
|
* and one CSS file (e.g. app.css) if you JavaScript imports CSS. |
25
|
|
|
*/ |
26
|
|
|
.addEntry('app', [ |
27
|
|
|
'./node_modules/jquery/dist/jquery.js', |
28
|
|
|
'./node_modules/bootstrap/dist/js/bootstrap.js', |
29
|
|
|
'./assets/js/app.js', |
30
|
|
|
'./node_modules/bootstrap/dist/css/bootstrap.css', |
31
|
|
|
'./assets/css/app.css', |
32
|
|
|
'./assets/css/rtl.css', |
33
|
|
|
]) |
34
|
|
|
|
35
|
|
|
.copyFiles({ |
36
|
|
|
from: './assets/images', |
37
|
|
|
}) |
38
|
|
|
|
39
|
|
|
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization. |
40
|
|
|
.splitEntryChunks() |
41
|
|
|
|
42
|
|
|
// will require an extra script tag for runtime.js |
43
|
|
|
// but, you probably want this, unless you're building a single-page app |
44
|
|
|
.enableSingleRuntimeChunk() |
45
|
|
|
|
46
|
|
|
/* |
47
|
|
|
* FEATURE CONFIG |
48
|
|
|
* |
49
|
|
|
* Enable & configure other features below. For a full |
50
|
|
|
* list of features, see: |
51
|
|
|
* https://symfony.com/doc/current/frontend.html#adding-more-features |
52
|
|
|
*/ |
53
|
|
|
.cleanupOutputBeforeBuild(['*.js', '*.css', '*.svg']) |
54
|
|
|
.enableBuildNotifications() |
55
|
|
|
.enableSourceMaps(!Encore.isProduction()) |
56
|
|
|
// enables hashed filenames (e.g. app.abc123.css) |
57
|
|
|
.enableVersioning(Encore.isProduction()) |
58
|
|
|
|
59
|
|
|
// enables @babel/preset-env polyfills |
60
|
|
|
.configureBabel(() => {}, { |
61
|
|
|
useBuiltIns: 'usage', |
62
|
|
|
corejs: 3 |
63
|
|
|
}) |
64
|
|
|
|
65
|
|
|
// enables Sass/SCSS support |
66
|
|
|
//.enableSassLoader() |
67
|
|
|
|
68
|
|
|
// uncomment if you use TypeScript |
69
|
|
|
//.enableTypeScriptLoader() |
70
|
|
|
|
71
|
|
|
// uncomment to get integrity="..." attributes on your script & link tags |
72
|
|
|
// requires WebpackEncoreBundle 1.4 or higher |
73
|
|
|
//.enableIntegrityHashes() |
74
|
|
|
|
75
|
|
|
// uncomment if you're having problems with a jQuery plugin |
76
|
|
|
//.autoProvidejQuery() |
77
|
|
|
|
78
|
|
|
// uncomment if you use API Platform Admin (composer req api-admin) |
79
|
|
|
//.enableReactPreset() |
80
|
|
|
//.addEntry('admin', './assets/js/admin.js') |
81
|
|
|
; |
82
|
|
|
|
83
|
|
|
module.exports = Encore.getWebpackConfig(); |
84
|
|
|
|