feature: imported webpack template

This commit is contained in:
plup 2019-11-03 17:22:37 +01:00
parent 401a000e5f
commit 3a321c2b00
26 changed files with 73 additions and 4615 deletions

9
.gitignore vendored
View File

@ -1,9 +1,4 @@
/node_modules
/src/config.json
/www/index.html
/www/index.*.html
/www/styles/
/www/scripts/
/www/lib/
/www/oidc-client-config.json
*.iml
*.iml
*.swp

4579
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,22 @@
"version": "1.0.0",
"license": "MIT",
"scripts": {
"serve": "node server.js"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/cli": "^7.4.4",
"node-sass": "^4.12.0",
"pug-cli": "^1.0.0-alpha6",
"express": "^4.16.4"
"build": "webpack --mode=production",
"serve": "webpack-dev-server --port 3000 --hot --host 0.0.0.0 --mode=development"
},
"dependencies": {
"include-media": "^1.4.9",
"normalize.css": "^8.0.1"
"@babel/core": "^7.6.4",
"babel-loader": "^8.0.6",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.9.0",
"html-webpack-plugin": "^3.2.0",
"pug": "^2.0.4",
"pug-loader": "^2.4.0",
"css-loader": "^3.2.0",
"node-sass": "^4.13.0",
"sass-loader": "^8.0.0",
"mini-css-extract-plugin": "^0.8.0",
"file-loader": "^4.2.0"
}
}

View File

@ -1,11 +0,0 @@
const port = 3000;
const distPath = 'www';
// express server
const { join } = require('path');
const express = require('express');
const app = express();
app
.use(express.static(distPath))
.get(/^[^.]*$/, (req, rep) => rep.sendFile(join(__dirname, distPath, '/index.html')))
.listen(port);

View File

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 559 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

56
webpack.config.js Normal file
View File

@ -0,0 +1,56 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const config = {
entry: {
app: './src/scripts/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.pug'
}),
new MiniCssExtractPlugin({
filename: "style.css"
})
],
module: {
rules: [
{
test: /\.pug$/,
use: "pug-loader"
},
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { url: false, sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: 'file-loader'
},
{
test: /\.(eot|ttf|woff|woff2)$/,
loader: 'file-loader',
}
]
}
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {}
if (argv.mode === 'production') {}
return config;
}

View File

@ -1,8 +0,0 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule \. - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>