-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
53 lines (42 loc) · 1.37 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
// webpack.config.js
const Encore = require('@symfony/webpack-encore');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
Encore
// Env
.configureRuntimeEnvironment("dev")
// the project directory where all compiled assets will be stored
.setOutputPath('public/build/')
// the public path used by the web server to access the previous directory
.setPublicPath('/build')
// will create public/build/app.js and public/build/app.css
.createSharedEntry('app', './assets/js/app.js')
.addEntry('homepage', './assets/js/components/forum/homepage.js')
.enableBuildNotifications()
// fixes modules that expect jQuery to be global
.autoProvidejQuery()
.addPlugin(new CopyWebpackPlugin([
// copies to {output}/static
{from: './assets/static', to: 'static'}
]))
.addPlugin(
new UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
)
.addLoader(
{
test: /\.yaml$/,
include: __dirname + '/translations',
loader: 'yaml',
}
)
.enableSassLoader()
.enableSourceMaps(!Encore.isProduction())
.cleanupOutputBeforeBuild()
.enableVersioning()
.enableReactPreset()
;
// export the final configuration
module.exports = Encore.getWebpackConfig();