-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (35 loc) · 1.31 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
var Encore = require('@symfony/webpack-encore');
const CopyWebpackPlugin = require('copy-webpack-plugin');
Encore
// 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')
.createSharedEntry('layout', './assets/js/layout.js')
.addEntry('rep_log_react', './assets/js/rep_log_react.js')
.addEntry('login', './assets/js/login.js')
.enableBuildNotifications()
// fixes modules that expect jQuery to be global
.autoProvidejQuery()
.disableSingleRuntimeChunk()
.addPlugin(new CopyWebpackPlugin([
// copies to {output}/static
{ from: './assets/static', to: 'static' }
]))
.enableSassLoader()
.enableSourceMaps(!Encore.isProduction())
.cleanupOutputBeforeBuild()
.enableVersioning(Encore.isProduction())
.enableReactPreset()
.configureBabel((babelConfig) => {
if(Encore.isProduction()){
babelConfig.plugins.push('transform-react-remove-prop-types');
}
babelConfig.plugins.push('@babel/plugin-proposal-object-rest-spread');
}, {
useBuiltIns: 'usage',
corejs: 2,
})
;
// export the final configuration
module.exports = Encore.getWebpackConfig();