Passed
Push — master ( 384857...16dbaf )
by Matt
08:13 queued 03:06
created

webpack.config.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 85
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 27
c 0
b 0
f 0
dl 0
loc 85
rs 10
wmc 3
mnd 1
bc 1
fnc 2
bpm 0.5
cpm 1.5
noi 0
1
const Encore = require('@symfony/webpack-encore');
2
3
// Manually configure the runtime environment if not already configured yet by the "encore" command.
4
// It's useful when you use tools that rely on webpack.config.js file.
5
if (!Encore.isRuntimeEnvironmentConfigured()) {
6
    Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
7
}
8
9
Encore
10
    // directory where compiled assets will be stored
11
    .setOutputPath('public/build/')
12
    // public path used by the web server to access the output path
13
    .setPublicPath('/build')
14
    // only needed for CDN's or sub-directory deploy
15
    //.setManifestKeyPrefix('build/')
16
17
    /*
18
     * ENTRY CONFIG
19
     *
20
     * Each entry will result in one JavaScript file (e.g. app.js)
21
     * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
22
     */
23
    .addEntry('app', './assets/app.js')
24
    .addEntry('admin', './assets/admin.js')
25
    .addEntry('adminimageupload', './assets/adminimageupload.js')
26
    .addEntry('map', './assets/map.js')
27
    .addEntry('homepage', './assets/homepage.js')
28
    .addEntry('wanderpage', './assets/wanderpage.js')
29
    .addEntry('imageclusterpage', './assets/imageclusterpage.js')
30
31
32
    // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
33
    .enableStimulusBridge('./assets/controllers.json')
34
35
    // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
36
    .splitEntryChunks()
37
38
    // will require an extra script tag for runtime.js
39
    // but, you probably want this, unless you're building a single-page app
40
    .enableSingleRuntimeChunk()
41
42
    /*
43
     * FEATURE CONFIG
44
     *
45
     * Enable & configure other features below. For a full
46
     * list of features, see:
47
     * https://symfony.com/doc/current/frontend.html#adding-more-features
48
     */
49
    .cleanupOutputBeforeBuild()
50
    .enableBuildNotifications()
51
    .enableSourceMaps(!Encore.isProduction())
52
    // enables hashed filenames (e.g. app.abc123.css)
53
    .enableVersioning(Encore.isProduction())
54
55
    .configureBabel((config) => {
56
        config.plugins.push('@babel/plugin-proposal-class-properties');
57
    })
58
59
    // enables @babel/preset-env polyfills
60
    .configureBabelPresetEnv((config) => {
61
        config.useBuiltIns = 'usage';
62
        config.corejs = 3;
63
    })
64
65
    // enables Sass/SCSS support
66
    //.enableSassLoader()
67
68
    // https://symfonycasts.com/screencast/webpack-encore/postcss-browsers
69
    .enablePostCssLoader()
70
71
    // uncomment if you use TypeScript
72
    //.enableTypeScriptLoader()
73
74
    // uncomment if you use React
75
    //.enableReactPreset()
76
77
    // uncomment to get integrity="..." attributes on your script & link tags
78
    // requires WebpackEncoreBundle 1.4 or higher
79
    //.enableIntegrityHashes(Encore.isProduction())
80
81
    // uncomment if you're having problems with a jQuery plugin
82
    //.autoProvidejQuery()
83
;
84
85
module.exports = Encore.getWebpackConfig();
86