forked from Cocolabs-SAS/cocorico
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
168 lines (138 loc) · 5.23 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
var Encore = require('@symfony/webpack-encore');
Encore
// Directory where compiled assets will be stored.
.setOutputPath('./web/assets/')
// Public URL path used by the web server to access the output path.
.setPublicPath('/assets/')
/*
* ENTRY CONFIG
*
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if you JavaScript imports CSS.
*/
.addEntry('common', [
'./web/js/vendors.js',
'./web/js/vendor/json2.js',
'./web/js/vendor/hammer.js',
'./web/js/vendor/bootstrap-multiselect.js',
'./web/js/vendor/bootstrap-datetimepicker.js',
'./web/js/vendor/parsley.min.js',
'./web/js/vendor/jquery.unslider.js',
'./web/js/vendor/jquery.caroufredsel.min.js',
'./web/js/vendor/jquery.clearsearch.js',
'./web/js/jquery.main.js',
'./web/js/jquery.main-override.js',
'./web/js/common.js',
'./web/js/date-time.js',
'./web/js/vendor/cookie-consent.js',
//'./node_modules/tarteaucitronjs/tarteaucitron.js',
'./web/css/vendor/bootstrap-datetimepicker.css',
'./web/css/vendor/bootstrap-multiselect.css',
'./web/css/vendor/unslider.css',
'./web/css/vendor/cookie-consent.css',
//'./web/css/all.css',
//'./web/css/all-override.css',
//'./web/css/itou.css',
'./web/css/final_import.scss',
])
.addEntry('bs4_common', [
'./web/js/vendors.js',
'./web/js/vendor/json2.js',
'./web/js/vendor/hammer.js',
'./web/js/vendor/parsley.min.js',
'./web/js/vendor/jquery.clearsearch.js',
'./web/js/jquery.main.js',
'./web/js/jquery.main-override.js',
'./web/js/common.js',
'./web/js/date-time.js',
'./web/js/vendor/cookie-consent.js',
//'./node_modules/tarteaucitronjs/tarteaucitron.js',
'./web/css/vendor/unslider.css',
'./web/css/vendor/cookie-consent.css',
//'./web/css/all.css',
//'./web/css/all-override.css',
//'./web/css/itou.css',
'./web/css/bs4_import.scss',
])
.addEntry('itou_common', [
'./web/js/vendors.js',
'./web/js/vendor/json2.js',
'./web/js/vendor/hammer.js',
'./web/js/vendor/parsley.min.js',
'./web/js/vendor/jquery.clearsearch.js',
'./web/js/vendor/bootstrap-multiselect.js',
'./web/js/jquery.main.js',
'./web/js/jquery.main-override.js',
'./web/js/common.js',
'./web/js/date-time.js',
'./web/js/vendor/cookie-consent.js',
//'./node_modules/tarteaucitronjs/tarteaucitron.js',
'./web/css/vendor/bootstrap-multiselect.css',
'./web/css/vendor/unslider.css',
'./web/css/vendor/cookie-consent.css',
'/web/itou/javascripts/app.js',
'/web/itou/stylesheets/app.css',
'./web/css/itou_marche.scss',
])
.addEntry('upload', [
'./web/js/upload.main.js'
])
.addEntry('calendar', [
'./web/js/vendor/fullcalendar/fullcalendar.min.js',
'./web/js/vendor/fullcalendar/lang-all.js'
])
.copyFiles([
{from: './node_modules/tarteaucitronjs/', to: 'tarteaucitron/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: true},
{from: './node_modules/ckeditor/', to: 'ckeditor/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: false},
{from: './node_modules/ckeditor/adapters', to: 'ckeditor/adapters/[path][name].[ext]'},
{from: './node_modules/ckeditor/lang', to: 'ckeditor/lang/[path][name].[ext]'},
{from: './node_modules/ckeditor/plugins', to: 'ckeditor/plugins/[path][name].[ext]'},
{from: './node_modules/ckeditor/skins', to: 'ckeditor/skins/[path][name].[ext]'}
])
// Preload legacy functionnality
.autoProvideVariables({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'root.jQuery': 'jquery',
// 'tarteaucitron' : 'tarteaucitron',
// $: 'webpack-jquery-ui',
// jQuery: 'webpack-jquery-ui',
// 'window.jQuery': 'webpack-jquery-ui',
// 'Cookies': 'js-cookie',
// jcf: 'jcf',
})
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
//.enableSingleRuntimeChunk()
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning()
// Other options.
//.enableEslintLoader()
.enableSassLoader()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
;
config = Encore.getWebpackConfig();
config.output.library = 'test';
config.output.libraryTarget = 'window';
config.output.libraryExport = 'default';
// console.log(config);
module.exports = {
stats: 'errors-only',
...config
}