Skip to content
This repository was archived by the owner on Sep 28, 2025. It is now read-only.

Commit b937c2c

Browse files
committed
chore: update build/release settings
1 parent f586379 commit b937c2c

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"start": "./node_modules/.bin/webpack-dev-server",
88
"build": "./node_modules/.bin/webpack --progress",
9-
"release": "./node_modules/.bin/webpack -p --progress",
9+
"release": "./node_modules/.bin/webpack -p --mode production --progress --output dist/clappr-pip.min.js",
1010
"watch": "./node_modules/.bin/webpack --watch",
1111
"test": "echo 'No tests configured'; exit 0"
1212
},

webpack.config.js

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,48 @@ const path = require('path')
22
const webpack = require('webpack')
33
const CleanWebpackPlugin = require('clean-webpack-plugin')
44

5-
var plugins = [
6-
new CleanWebpackPlugin(['dist']),
5+
let plugins = [
76
new webpack.DefinePlugin({
87
version: JSON.stringify(require('./package.json').version),
98
})
109
];
1110

12-
module.exports = {
13-
mode: 'none',
14-
entry: path.resolve(__dirname, 'src/index.js'),
15-
plugins: plugins,
16-
externals: {
17-
clappr: 'Clappr'
18-
},
19-
module: {
20-
rules: [
21-
{
22-
test: /\.js$/,
23-
loader: 'babel-loader'
24-
},
25-
{
26-
test: /\.svg/, loader: 'svg-inline-loader'
27-
},
28-
],
29-
},
30-
resolve: {
31-
extensions: ['.js'],
32-
},
33-
output: {
34-
path: path.resolve(__dirname, 'dist'),
35-
filename: 'clappr-pip.js',
36-
library: 'ClapprPip',
37-
libraryTarget: 'umd',
38-
},
39-
devServer: {
40-
contentBase: 'public/',
41-
host: '0.0.0.0',
42-
disableHostCheck: true,
43-
inline: false
44-
},
11+
module.exports = (env, argv) => {
12+
if (argv.mode !== 'production') {
13+
plugins.push(new CleanWebpackPlugin(['dist']));
14+
}
15+
return {
16+
mode: argv.mode || 'none',
17+
entry: path.resolve(__dirname, 'src/index.js'),
18+
plugins: plugins,
19+
externals: {
20+
clappr: 'Clappr'
21+
},
22+
module: {
23+
rules: [
24+
{
25+
test: /\.js$/,
26+
loader: 'babel-loader'
27+
},
28+
{
29+
test: /\.svg/, loader: 'svg-inline-loader'
30+
},
31+
],
32+
},
33+
resolve: {
34+
extensions: ['.js'],
35+
},
36+
output: {
37+
path: path.resolve(__dirname, 'dist'),
38+
filename: 'clappr-pip.js',
39+
library: 'ClapprPip',
40+
libraryTarget: 'umd',
41+
},
42+
devServer: {
43+
contentBase: 'public/',
44+
host: '0.0.0.0',
45+
disableHostCheck: true,
46+
inline: false
47+
},
48+
};
4549
};

0 commit comments

Comments
 (0)