This repository has been archived by the owner on Apr 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
webpack.config.js
33 lines (31 loc) · 1.34 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
var Encore = require('@symfony/webpack-encore');
var SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
Encore
.addEntry('app', './src/app.js') // will create public/build/app.js and public/build/app.css
.setOutputPath('public/assets') // the project directory where all compiled assets will be stored
.setPublicPath('/assets') // the public path used by the web server to access the previous directory
.enableSassLoader() // allow sass/scss files to be processed
.enableSourceMaps(!Encore.isProduction())
.cleanupOutputBeforeBuild() // empty the outputPath dir before each build
.autoProvideVariables({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
}).addPlugin(
new SWPrecacheWebpackPlugin(
{
cacheId: 'Symfonator',
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
minify: true,
navigateFallback: 'index.html',
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
})
)
.enableBuildNotifications() // show OS notifications when builds finish/fail
// create hashed filenames (e.g. app.abc123.css)
// .enableVersioning()
;
// export the final configuration
module.exports = Encore.getWebpackConfig();