Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jimfrenette/hugo-starter.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjimfrenette <jimfrenette@yahoo.com>2019-01-24 03:48:19 +0300
committerjimfrenette <jimfrenette@yahoo.com>2019-01-24 03:51:26 +0300
commit1665de41ba5618ddfb1e4f713de3a3be0228f15a (patch)
tree5181700dc27644e1a6d50a456878814854f44055 /webpack
initial commit
Diffstat (limited to 'webpack')
-rw-r--r--webpack/base.config.js32
-rw-r--r--webpack/dev.config.js22
-rw-r--r--webpack/prod.config.js18
3 files changed, 72 insertions, 0 deletions
diff --git a/webpack/base.config.js b/webpack/base.config.js
new file mode 100644
index 0000000..9c11902
--- /dev/null
+++ b/webpack/base.config.js
@@ -0,0 +1,32 @@
+const path = require('path');
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+
+module.exports = {
+ context: path.resolve(__dirname, '../src'),
+ entry: {
+ app: ['./js/index.js']
+ },
+ plugins: [
+ new MiniCssExtractPlugin
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.(css|scss)$/,
+ use: [
+ MiniCssExtractPlugin.loader,
+ 'css-loader',
+ {
+ loader: 'postcss-loader' },
+ {
+ loader: 'sass-loader' }
+ ]
+ },
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: 'babel-loader'
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/webpack/dev.config.js b/webpack/dev.config.js
new file mode 100644
index 0000000..ee30c5f
--- /dev/null
+++ b/webpack/dev.config.js
@@ -0,0 +1,22 @@
+const baseConfig = require('./base.config.js');
+const merge = require('webpack-merge');
+const { WebpackPluginServe: Serve } = require('webpack-plugin-serve');
+
+const serve = new Serve({
+ host: 'localhost',
+ static: ['../../public/'],
+ open: true,
+ liveReload: true
+});
+
+module.exports = merge(baseConfig, {
+ mode: 'development',
+ devtool: 'eval-source-map',
+ entry: {
+ app: ['webpack-plugin-serve/client']
+ },
+ plugins: [
+ serve
+ ],
+ watch: true
+}); \ No newline at end of file
diff --git a/webpack/prod.config.js b/webpack/prod.config.js
new file mode 100644
index 0000000..4233037
--- /dev/null
+++ b/webpack/prod.config.js
@@ -0,0 +1,18 @@
+const baseConfig = require('./base.config.js');
+const merge = require('webpack-merge');
+const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
+const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
+
+module.exports = merge(baseConfig, {
+ mode: 'production',
+ optimization: {
+ minimizer: [
+ new OptimizeCSSAssetsPlugin({})
+ ]
+ },
+ plugins: [
+ new UglifyJsPlugin({
+ uglifyOptions: { output: { comments: false } }
+ })
+ ]
+}); \ No newline at end of file