-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
72 lines (55 loc) · 2.13 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
const Encore = require('@symfony/webpack-encore');
const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
const { styles } = require( '@ckeditor/ckeditor5-dev-utils' );
Encore
// the project directory where all compiled assets will be stored
.setOutputPath('./Resources/public')
// the public path used by the web server to access the previous directory
.setPublicPath('/bundles/unitecmswysiwygfield')
// Used as a prefix to the *keys* in manifest.json
.setManifestKeyPrefix('')
.addEntry('main', './Resources/webpack/main.js')
// allow sass/scss files to be processed
.enableSassLoader(function(sassConfigOptions){
sassConfigOptions.includePaths = ['./node_modules'];
})
// load vue components
.enableVueLoader()
// Enable sourcemaps in production mode
.enableSourceMaps(!Encore.isProduction())
// empty the outputPath dir before each build
.cleanupOutputBeforeBuild()
// versioning to avoid browser cache loading old assets
.enableVersioning(Encore.isProduction())
// We don't need a runtime.js for unite cms at the moment
.disableSingleRuntimeChunk()
.disableImagesLoader()
.addPlugin(new CKEditorWebpackPlugin({ language: 'en' }))
.enablePostCssLoader(function(postCssConfigOptions){
let options = styles.getPostCssConfig( {
themeImporter: {
themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' )
},
minify: Encore.isProduction()
});
postCssConfigOptions.plugins = options.plugins;
})
.addRule({
test: /\.(svg|png|jpg|jpeg|gif|ico)/,
exclude: __dirname + '/node_modules/@ckeditor',
use: [{
loader: 'file-loader',
options: {
filename: 'images/[name].[hash:8].[ext]',
publicPath: '/build/'
}
}]
})
.addRule({
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: [{
loader: 'raw-loader'
}],
});
// export the final configuration
module.exports = Encore.getWebpackConfig();