summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-06-19 08:17:22 +0200
committerHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-06-19 08:17:22 +0200
commit3725c0edccec80adc09b6855434bad65e5901a63 (patch)
tree0a7754a3512a316e39a94024b65f783a140f2de0 /webpack.config.js
STRUCT Repo structure with basic layout
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