-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathwebpack.config.js
More file actions
95 lines (78 loc) · 2.21 KB
/
webpack.config.js
File metadata and controls
95 lines (78 loc) · 2.21 KB
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
const path = require('path');
const webpack = require('webpack');
const Encore = require('@symfony/webpack-encore');
const style = process.env.style || 'all';
const jqueryUITheme = process.env.jq_ui_theme || 'smoothness';
const paths = {
entry: path.resolve(__dirname, 'develop'),
output: path.resolve(__dirname, `styles/${style}/theme/assets`),
};
Encore.setOutputPath(paths.output)
.setPublicPath('../')
.setManifestKeyPrefix('../')
.addStyleEntry('sitemaker', paths.entry + '/sitemaker.scss')
.addStyleEntry('navbar', paths.entry + '/navbar.scss')
.addEntry('blocks/manager', paths.entry + '/entries/blocks/manager.js')
.addEntry('menu/admin', paths.entry + '/entries/menu/')
.addEntry('tree/group', paths.entry + '/components/TreeGroup/')
.addEntry('settings/admin', paths.entry + '/entries/settings/')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableSingleRuntimeChunk()
.configureSplitChunks((splitChunks) => {
splitChunks.chunks = 'all';
splitChunks.cacheGroups = {
default: false,
vendors: false,
codemirror: {
name: 'codemirror/codemirror',
test: /[\\/]codemirror[\\/]/,
chunks: 'all',
enforce: true,
},
colorpicker: {
name: 'spectrum/colorpicker',
test: /[\\/]spectrum-colorpicker2[\\/]/,
chunks: 'all',
enforce: true,
},
twig: {
name: 'twig/twig',
test: /[\\/]twig[\\/]/,
chunks: 'all',
enforce: true,
},
};
})
.enablePostCssLoader()
.enableSassLoader()
.enableEslintLoader()
.autoProvidejQuery()
.addExternals({
jquery: 'jQuery',
})
.addAliases({
'jquery-ui/sortable': 'jquery-ui/ui/widgets/sortable',
})
.copyFiles([
{
from: './node_modules/tinymce/',
to: 'tinymce/[path][name].[ext]',
pattern: /^(?!composer\.json).*$/,
},
])
.addPlugin(
new webpack.NormalModuleReplacementPlugin(
/jquery-ui\/themes\/base\/(core|theme).css/,
(resource) => {
const filename = path.basename(resource.request, '.css');
const type = filename === 'core' ? 'jquery-ui' : 'theme';
resource.request = `jquery-ui-themes/themes/${jqueryUITheme}/${type}.css`;
},
),
)
.configureFilenames({
js: '[name].min.js',
css: '[name].min.css',
});
module.exports = Encore.getWebpackConfig();