-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
54 lines (46 loc) · 1.33 KB
/
webpack.prod.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
47
48
49
50
51
52
53
54
const path = require("path");
const buildPath = path.resolve(__dirname, "dist");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const CopyWebpackPlugin = require("copy-webpack-plugin");
const sass = require('sass');
module.exports = {
mode: 'production',
// https://webpack.js.org/concepts/entry-points/#multi-page-application
entry: './src/lib/angular-select.js',
// how to write the compiled files to disk
// https://webpack.js.org/concepts/output/
output: {
filename: "angular-select-umd.min.js",
path: path.resolve(__dirname, "dist/lib"),
clean: true,
library: {
name: "angular-select",
type: "umd"
},
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: "src/lib/angular-select.js",
to: 'angular-select-esm.min.js'
},
{
from: "src/lib/angular-select.scss",
to: "angular-select.min.css",
transform (content, path) {
const result = sass.renderSync({
file: path
});
return result.css.toString().replace(/\s+/g, ' ').trim();
},
},
],
}),
],
optimization: {
minimize: true,
},
};