forked from chamilo/chamilo-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·166 lines (151 loc) · 4.88 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
const Encore = require("@symfony/webpack-encore")
const dotenv = require('dotenv');
const webpack = require('webpack');
const env = dotenv.config()
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || "dev")
}
Encore.setOutputPath("public/build/")
.setManifestKeyPrefix("public/build/")
.setPublicPath("/build")
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.addEntry("legacy_app", "./assets/js/legacy/app.js")
.addEntry("legacy_exercise", "./assets/js/legacy/exercise.js")
.addEntry("legacy_free-jqgrid", "./assets/js/legacy/free-jqgrid.js")
.addEntry("legacy_lp", "./assets/js/legacy/lp.js")
.addEntry("legacy_document", "./assets/js/legacy/document.js")
.addEntry("vue", "./assets/vue/main.js")
.addEntry("vue_installer", "./assets/vue/main_installer.js")
.addEntry("translatehtml", "./assets/js/translatehtml.js")
.addStyleEntry("app", "./assets/css/app.scss")
.addStyleEntry("css/chat", "./assets/css/chat.css")
.addStyleEntry("css/document", "./assets/css/document.css")
.addStyleEntry("css/editor", "./assets/css/editor.css")
.addStyleEntry("css/editor_content", "./assets/css/editor_content.css")
.addStyleEntry("css/markdown", "./assets/css/markdown.css")
.addStyleEntry("css/print", "./assets/css/print.css")
.addStyleEntry("css/responsive", "./assets/css/responsive.css")
.addStyleEntry("css/scorm", "./assets/css/scorm.scss")
.enableSingleRuntimeChunk()
.enableIntegrityHashes()
.enableSourceMaps(!Encore.isProduction())
// enables @babel/preset-env polyfills
.configureBabel(() => {})
.configureBabelPresetEnv((config) => {
config.useBuiltIns = "usage"
config.corejs = 3
})
.enableSassLoader()
.enableTypeScriptLoader(function (tsConfig) {
tsConfig.transpileOnly = true
//tsConfig.configFile = './tsconfig.json';
//tsConfig.exclude = ['/node_modules(?!\\/vuex-composition-helpers)/'];
})
.enableVueLoader(() => {}, { version: 3, runtimeCompilerBuild: false })
.autoProvidejQuery()
.enablePostCssLoader((options) => {
options.postcssOptions = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
})
.copyFiles([
{
from: "./node_modules/multiselect-two-sides/dist/js",
pattern: /(multiselect.js)$/,
to: "libs/multiselect-two-sides/dist/js/multiselect.js",
},
{
from: "./node_modules/pwstrength-bootstrap/dist/",
pattern: /(pwstrength-bootstrap.js)$/,
to: "libs/pwstrength-bootstrap/dist/pwstrength-bootstrap.js",
},
{
from: "./node_modules/readmore-js",
pattern: /(readmore.js)$/,
to: "libs/readmore-js/readmore.js",
},
{
from: "./node_modules/js-cookie/src/",
pattern: /(js.cookie.js)$/,
to: "libs/js-cookie/src/js.cookie.js",
},
{
from: "./node_modules/qtip2/dist/basic",
pattern: /(jquery.qtip.js)$/,
to: "libs/qtip2/dist/jquery.qtip.js",
},
{
from: "./node_modules/qtip2/dist/basic",
pattern: /(jquery.qtip.css)$/,
to: "libs/qtip2/dist/jquery.qtip.css",
},
{
from: "./node_modules/flatpickr/dist/l10n",
to: "flatpickr/l10n/[name].[ext]",
},
/*,
{
from: './node_modules/mathjax/',
pattern: /(MathJax.js)$/,
to: 'libs/mathjax/MathJax.js'
},*/
])
.addPlugin(
new webpack.DefinePlugin({
'ENV_CUSTOM_VUE_TEMPLATE': JSON.stringify(env.parsed?.APP_CUSTOM_VUE_TEMPLATE),
})
)
Encore.copyFiles({
from: "./node_modules/mediaelement/build",
to: "libs/mediaelement/[path][name].[ext]",
})
Encore.copyFiles({
from: "./node_modules/mediaelement-plugins/dist",
to: "libs/mediaelement/plugins/[path][name].[ext]",
})
Encore.copyFiles({
from: "./node_modules/mathjax/config",
to: "libs/mathjax/config/[path][name].[ext]",
})
Encore.copyFiles({
from: "node_modules/moment/locale",
to: "libs/locale/[path][name].[ext]",
})
Encore.copyFiles({
from: "./node_modules/select2/dist/css",
to: "libs/select2/css/[name].[ext]",
})
Encore.copyFiles({
from: "./node_modules/select2/dist/js",
to: "libs/select2/js/[name].[ext]",
})
const themes = ["chamilo"]
// Add Chamilo themes
themes.forEach(function (theme) {
Encore.addStyleEntry("css/themes/" + theme + "/default", "./assets/css/themes/" + theme + "/default.css")
// Copy images from themes into public/build
Encore.copyFiles({
from: "assets/css/themes/" + theme + "/images",
to: "css/themes/" + theme + "/images/[name].[ext]",
})
})
// Fix free-jqgrid languages files
// Encore.addPlugin(new FileManagerPlugin({
// onEnd: {
// move: [
// {
// source: './public/public/build/free-jqgrid/',
// destination: './public/build/free-jqgrid/'
// }
// ],
// delete: [
// './public/public/'
// ]
// }
// }));
const config = Encore.getWebpackConfig()
module.exports = config