-
Notifications
You must be signed in to change notification settings - Fork 481
/
webpack.config.js
executable file
·140 lines (128 loc) · 4.17 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
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("legacy_framereadyloader", "./assets/js/legacy/frameReadyLoader.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
})
.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/chart.js/dist/",
to: "libs/chartjs/[name].[ext]",
pattern: /\.(js|css)$/,
}
])
.addPlugin(
new webpack.DefinePlugin({
ENV_CUSTOM_VUE_TEMPLATE: JSON.stringify(env.parsed?.APP_CUSTOM_VUE_TEMPLATE),
}),
)
.configureDevServerOptions((options) => {
options.host = "0.0.0.0"
})
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 config = Encore.getWebpackConfig()
module.exports = config