Skip to content

Commit

Permalink
add version number and build date on cdn link (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
necessarylion authored Mar 28, 2023
1 parent 83adaf6 commit 8d3bf09
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"prettier": "^2.8.7",
"sass-loader": "^13.2.1",
"style-loader": "^3.3.2",
"terser-webpack-plugin": "^5.3.7",
"ts-loader": "^9.4.2",
"typescript": "^5.0.2",
"webpack": "^5.76.3",
Expand Down
24 changes: 20 additions & 4 deletions webpack.cdn.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const pkg = require('./package.json')

module.exports = {
mode: 'production',
Expand All @@ -8,14 +10,28 @@ module.exports = {
filename: 'search-js.js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
preamble: `/* Search JS | Version : ${pkg.version} | Date : ${new Date().toUTCString()} */`,
comments: false
}
},
extractComments: false,
}),
],
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html'
})
template: './index.html',
}),
],
devServer: {
port: 3000,
open: true
open: true,
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
Expand Down

0 comments on commit 8d3bf09

Please sign in to comment.