-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (32 loc) · 1.48 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
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const assets_path = path.resolve('./src/AppBundle/Resources/private');
const output_path = (Encore.isProduction()) ? path.resolve('./src/AppBundle/Resources/public') : path.resolve('./src/AppBundle/Resources/public');
const public_path = (Encore.isProduction()) ? '/bundles/app' : '/public';
const sass_path = path.join(assets_path, './sass');
const js_path = path.join(assets_path, './js');
Encore
// empty the outputPath dir before each build
// .cleanupOutputBeforeBuild()
// directory where all compiled assets will be stored
.setOutputPath(output_path)
// what's the public path to this directory (relative to your project's document root dir)
.setPublicPath(public_path)
// will output as web/build/app.js
.addEntry('app', path.join(js_path, '/app.js'))
// will output as web/build/global.css
.addStyleEntry('style', path.join(sass_path, '/style.scss'))
// allow sass/scss files to be processed
.enableSassLoader()
.enablePostCssLoader()
.enableSourceMaps(!Encore.isProduction())
// create hashed filenames (e.g. app.abc123.css)
.enableVersioning(false)
.setManifestKeyPrefix('bundles/app');
var config = Encore.getWebpackConfig();
config.watchOptions = { poll: true, ignored: /node_modules/ };
if (config.devServer) {
config.devServer.watchContentBase = true;
}
// export the final configuration
module.exports = config;