1 | var 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 | * Add 1 entry for each "page" of your app |
||
21 | * (including one that's included on every page - e.g. "app") |
||
22 | * |
||
23 | * Each entry will result in one JavaScript file (e.g. app.js) |
||
24 | * and one CSS file (e.g. app.css) if your JavaScript imports CSS. |
||
25 | */ |
||
26 | .addEntry('app', './assets/js/app.js') |
||
27 | //.addEntry('page1', './assets/js/page1.js') |
||
28 | //.addEntry('page2', './assets/js/page2.js') |
||
29 | |||
30 | // When enabled, Webpack "splits" your files into smaller pieces for greater optimization. |
||
31 | .splitEntryChunks() |
||
32 | |||
33 | // will require an extra script tag for runtime.js |
||
34 | // but, you probably want this, unless you're building a single-page app |
||
35 | .enableSingleRuntimeChunk() |
||
36 | |||
37 | /* |
||
38 | * FEATURE CONFIG |
||
39 | * |
||
40 | * Enable & configure other features below. For a full |
||
41 | * list of features, see: |
||
42 | * https://symfony.com/doc/current/frontend.html#adding-more-features |
||
43 | */ |
||
44 | .cleanupOutputBeforeBuild() |
||
45 | .enableBuildNotifications() |
||
46 | .enableSourceMaps(!Encore.isProduction()) |
||
47 | // enables hashed filenames (e.g. app.abc123.css) |
||
48 | .enableVersioning(Encore.isProduction()) |
||
49 | |||
50 | // enables @babel/preset-env polyfills |
||
51 | .configureBabel(() => {}, { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
52 | useBuiltIns: 'usage', |
||
53 | corejs: 3 |
||
54 | }) |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
55 | |||
56 | // enables Sass/SCSS support |
||
57 | //.enableSassLoader() |
||
58 | |||
59 | // uncomment if you use TypeScript |
||
60 | //.enableTypeScriptLoader() |
||
61 | |||
62 | // uncomment to get integrity="..." attributes on your script & link tags |
||
63 | // requires WebpackEncoreBundle 1.4 or higher |
||
64 | //.enableIntegrityHashes(Encore.isProduction()) |
||
65 | |||
66 | // uncomment if you're having problems with a jQuery plugin |
||
67 | //.autoProvidejQuery() |
||
68 | |||
69 | // uncomment if you use API Platform Admin (composer req api-admin) |
||
70 | //.enableReactPreset() |
||
71 | //.addEntry('admin', './assets/js/admin.js') |
||
72 | ; |
||
73 | |||
74 | module.exports = Encore.getWebpackConfig(); |
||
75 |