-
Notifications
You must be signed in to change notification settings - Fork 519
/
webpack.config.js
33 lines (29 loc) · 1.1 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
const Encore = require("@symfony/webpack-encore");
const ESLintPlugin = require("eslint-webpack-plugin");
const glob = require("glob");
const path = require("path");
const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
Encore.addEntry("app", "./views/assets/js/app.js")
.addStyleEntry("style", "./views/assets/css/style.scss")
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSassLoader()
.addPlugin(new ESLintPlugin())
.enableSourceMaps(!Encore.isProduction())
.setOutputPath("views/build/")
.setPublicPath("/build")
.addPlugin(
new PurgeCSSPlugin({
paths: glob.sync(`${path.join(__dirname, "views")}/**/*`, {
nodir: true,
}),
}),
);
const config = Encore.getWebpackConfig();
// Set IE11-friendly defaults
// https://webpack.js.org/configuration/output/#outputenvironment
config.output.environment = config.output.environment || {};
config.output.environment.arrowFunction = false;
config.output.environment.const = false;
config.output.environment.destructuring = false;
module.exports = config;