aboutsummaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..c4934a0
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,59 @@
+const path = require('path');
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+const CleanWebpackPlugin = require('clean-webpack-plugin');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
+
+module.exports = {
+ mode: 'production',
+ entry: './src/app.js',
+ output: {
+ filename: 'app.js',
+ path: __dirname + '/dist'
+ },
+ optimization: {
+ minimizer: [new UglifyJsPlugin()],
+ },
+ plugins: [
+ new CleanWebpackPlugin(['dist']),
+ new CopyPlugin([
+ {
+ from: 'src/icon.*',
+ flatten: true
+ },
+ {
+ from: 'src/config.xml',
+ flatten: true
+ }
+ ]),
+ new HtmlWebpackPlugin({
+ template: 'src/index.html',
+ filename: 'index.html',
+ inject: 'head'
+ }),
+ new MiniCSSExtractPlugin({
+ filename: 'app.css',
+ path: __dirname + '/dist'
+ })
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: [
+ 'style-loader',
+ 'css-loader'
+ ]
+ },
+ {
+ test: /\.scss$/,
+ use: [
+ MiniCSSExtractPlugin.loader,
+ "css-loader",
+ "sass-loader"
+ ]
+ }
+ ]
+ }
+};  \ No newline at end of file