Skip to content

Commit d5a5831

Browse files
authored
Update build scripts (#2)
1 parent 899c38f commit d5a5831

File tree

3 files changed

+102
-51
lines changed

3 files changed

+102
-51
lines changed

_develop/webpack.config.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const webpack = require('webpack');
33
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4+
const TerserPlugin = require('terser-webpack-plugin');
45
const pkg = require('../package.json');
56

67
const bannerPack = new webpack.BannerPlugin({
@@ -137,18 +138,31 @@ const baseConfig = {
137138
};
138139

139140
module.exports = env => {
140-
if (env && env.minimize) {
141-
const { devServer, ...prodConfig } = baseConfig;
141+
if (env && env.production) {
142+
const { devServer, entry, ...prodConfig } = baseConfig;
142143
return {
143144
...prodConfig,
144145
mode: 'production',
145-
entry: { 'quill.min.js': './quill.js' },
146-
devtool: 'source-map',
146+
entry: {
147+
...entry,
148+
'quill.min.js': './quill.js',
149+
},
150+
optimization: {
151+
minimize: true,
152+
minimizer: [
153+
new TerserPlugin({
154+
test: /\.min\.js$/,
155+
}),
156+
],
157+
},
158+
devtool: '',
147159
};
148160
}
161+
149162
if (env && env.coverage) {
150163
baseConfig.module.rules[0].use[0].options.plugins = ['istanbul'];
151164
return baseConfig;
152165
}
166+
153167
return baseConfig;
154168
};

package-lock.json

Lines changed: 80 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devextreme-quill",
3-
"version": "0.9.7",
3+
"version": "0.9.8",
44
"description": "Core of the DevExtrene HtmlEditor",
55
"author": "Developer Express Inc.",
66
"main": "dist/dx-quill.js",
@@ -71,6 +71,7 @@
7171
"style-loader": "~1.1.3",
7272
"stylus": "~0.54.7",
7373
"stylus-loader": "^3.0.2",
74+
"terser-webpack-plugin": "^1.3.0",
7475
"ts-loader": "^6.2.2",
7576
"typescript": "^3.8.3",
7677
"webpack": "^4.42.1",
@@ -150,10 +151,9 @@
150151
},
151152
"scripts": {
152153
"build": "npm run lint && rimraf dist/* && npm run build:webpack",
153-
"build-dist": "npm run lint && rimraf dist/* && npm run build:webpack-min && npm run build:webpack",
154+
"build-dist": "npm run lint && rimraf dist/* && npm run build:webpack-prod",
154155
"build:webpack": "webpack --config _develop/webpack.config.js && rimraf dist/dx-quill.core dist/dx-quill.bubble dist/dx-quill.snow",
155-
"build:webpack-min": "webpack --config _develop/webpack.config.js --env.minimize && rimraf dist/dx-quill.core dist/dx-quill.bubble dist/dx-quill.snow",
156-
"build:release": "./_develop/scripts/release.sh",
156+
"build:webpack-prod": "webpack --config _develop/webpack.config.js --env.production && rimraf dist/dx-quill.core dist/dx-quill.bubble dist/dx-quill.snow",
157157
"develop": "npm run start",
158158
"lint": "eslint blots core formats modules test utils",
159159
"start": "npm run build:webpack && bundle exec foreman start -f _develop/procfile",

0 commit comments

Comments
 (0)