Commit 0350f980 authored by Asanka Anthony's avatar Asanka Anthony

webpack added

parent c81c95d2
{
"webpack-schluss": {
"configuration": {
"config": {
"topScope": [
"const webpack = require('webpack')",
"const path = require('path')",
"\n",
"/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
"/*\n * We've enabled UglifyJSPlugin for you! This minifies your app\n * in order to load faster and run less javascript.\n *\n * https://github.com/webpack-contrib/uglifyjs-webpack-plugin\n *\n */",
"const UglifyJSPlugin = require('uglifyjs-webpack-plugin');",
"\n"
],
"webpackOptions": {
"module": {
"rules": [
{
"include": [
"path.resolve(__dirname, 'src')"
],
"loader": "'babel-loader'",
"options": {
"plugins": [
"'syntax-dynamic-import'"
],
"presets": [
[
"'@babel/preset-env'",
{
"'modules'": false
}
]
]
},
"test": "/\\.js$/"
},
{
"test": "/\\.(scss|css)$/",
"use": [
{
"loader": "'style-loader'"
},
{
"loader": "'css-loader'"
},
{
"loader": "'sass-loader'"
}
]
}
]
},
"output": {
"chunkFilename": "'[name].[chunkhash].js'",
"filename": "'[name].[chunkhash].js'"
},
"mode": "'development'",
"plugins": [
"new UglifyJSPlugin()"
],
"optimization": {
"splitChunks": {
"cacheGroups": {
"vendors": {
"priority": -10,
"test": "/[\\\\/]node_modules[\\\\/]/"
}
},
"chunks": "'async'",
"minChunks": 1,
"minSize": 30000,
"name": true
}
}
},
"configName": "config"
}
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -7,6 +7,10 @@
"type": "git",
"url": "https://gitlab.com/schluss/schluss.app.git"
},
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server --https --hot --progress --colors --open"
},
"author": "Bob Hageman <bob@schluss.org>",
"license": "UNKNOWN",
"bugs": {
......@@ -15,6 +19,8 @@
"homepage": "https://www.schluss.org",
"private": true,
"dependencies": {
"@babel/polyfill": "^7.4.4",
"babel-polyfill": "^6.26.0",
"cryptico": "^1.0.2",
"crypto-js": "^3.1.9-1",
"gulp-replace-template": "^0.1.2",
......@@ -27,7 +33,12 @@
"sammy": "^0.7.6"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"browserify": "^16.2.3",
"copy-webpack-plugin": "^5.0.3",
"gulp": "^3.9.1",
"gulp-clean": "^0.4.0",
"gulp-htmlmin": "^5.0.1",
......@@ -37,8 +48,12 @@
"gulp-watch": "^5.0.1",
"gulp-webserver": "^0.9.1",
"gulplog": "^1.0.0",
"html-webpack-plugin": "^3.2.0",
"run-sequence": "^2.2.1",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
"vinyl-source-stream": "^2.0.0",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.3.1"
}
}
......@@ -27,7 +27,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
<script src="assets/js/app.js" type="text/javascript"></script>
<script src="dist/app.js" type="text/javascript"></script>
</head>
......@@ -37,12 +37,12 @@
</div>
<script type="text/javascript">
$( document ).ready(function() {
/*$( document ).ready(function() {
$('#hamburger').click(function(){
$('#mainnav').toggleClass('show');
});
});
});*/
</script>
</body>
</html>
\ No newline at end of file
......@@ -18,7 +18,7 @@ require('jquery-pinlogin/src/jquery.pinlogin.js');
const config = require('./config.js');
// routing / framework
var app = require('sammy');
var app = $.sammy = require('sammy');
// manually include some sammy plugins, ugly, but the only way I know of that works
require('sammy/lib/plugins/sammy.template.js');
......
/*
* SplitChunksPlugin is enabled by default and replaced
* deprecated CommonsChunkPlugin. It automatically identifies modules which
* should be splitted of chunk by heuristics using module duplication count and
* module category (i. e. node_modules). And splits the chunks…
*
* It is safe to remove "splitChunks" from the generated configuration
* and was added as an educational example.
*
* https://webpack.js.org/plugins/split-chunks-plugin/
*
*/
/*
* We've enabled UglifyJSPlugin for you! This minifies your app
* in order to load faster and run less javascript.
*
* https://github.com/webpack-contrib/uglifyjs-webpack-plugin
*
*/
const webpack = require('webpack');
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
entry: {
app: ['babel-polyfill', './src/scripts/app.js','sammy'],
worker: ['babel-polyfill', './src/scripts/worker.js'],
},
output: {
filename: '[name].js',
globalObject: 'this'
},
devtool: "cheap-module-eval-source-map",
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader?cacheDirectory',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.(scss|css)$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader'
},
{
loader: 'sass-loader'
}
]
}
]
},
mode: 'development',
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: 4,//Enable multi-process parallel running and set number of concurrent runs.
sourceMap: true, // Must be set to true if using source-maps in production
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
}
}),
],
},
plugins: [
new htmlWebpackPlugin({
inject: false,
template:path.join(__dirname,'src','index.html')
}),
// copy static assets to dist folder
new CopyWebpackPlugin([{
from: path.join(__dirname, 'src'),
to: path.join(__dirname, 'dist'),
ignore: ['scripts/**/*'],
}
])
],
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment