-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
32 lines (30 loc) · 1001 Bytes
/
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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
/**
* Get the current version defined in the package.json file
*/
const CURRENT_VERSION = process.env.npm_package_version;
module.exports = {
entry: './app/app.js',
output: {
path: path.resolve(__dirname, 'dist/'),
filename: `bundle.${CURRENT_VERSION}.js`
},
plugins: [
// Define the version number as global const
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(CURRENT_VERSION)
}),
new HtmlWebpackPlugin({
title: 'HTML Offline app',
template: './app/html/template.html',
filename: 'index.html'
}),
// Copy workers files
new CopyWebpackPlugin([
{from: './app/js/workers/**/*.js', to: `[name].${CURRENT_VERSION}.[ext]`, toType: 'template'}
])
]
};