added webpack

This commit is contained in:
Felix Hamann 2019-05-25 22:09:16 +02:00
parent e0801c2110
commit 2e9e7e2d9c
7 changed files with 4279 additions and 91 deletions

View File

@ -7,10 +7,6 @@
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"HttpClient": "readonly",
"UtilRegistry": "readonly",
"HtmlHelpers": "readonly",
"I18n": "readonly",
"flatpickr": "readonly",
"$": "readonly"
},

File diff suppressed because it is too large Load Diff

48
frontend/package.json Normal file
View File

@ -0,0 +1,48 @@
{
"name": "uni2work",
"version": "1.0.0",
"description": "",
"keywords": [],
"author": "",
"license": "ISC",
"scripts": {
"lint": "eslint src",
"dev": "webpack --watch"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/js/**/*.js": [
"eslint",
"git add"
]
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"autoprefixer": "^9.5.1",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.6",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^2.1.0",
"eslint": "^5.16.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"node-sass": "^4.11.0",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"watch": "^1.0.2",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
}
}

View File

@ -0,0 +1,6 @@
/* eslint-disable */
module.exports = {
plugins: [
require('autoprefixer')
]
}

108
frontend/webpack.config.js Normal file
View File

@ -0,0 +1,108 @@
/* eslint-disable */
const webpack = require('webpack');
const path = require('path');
const ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
/*
* 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 UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
module: {
rules: [
{
loader: 'babel-loader',
options: {
plugins: ['syntax-dynamic-import'],
presets: [
[
'@babel/preset-env',
{
modules: false
}
]
]
},
test: /\.js$/
},
{
test: /\.css$/,
use: ExtractTextWebpackPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
{
test: /\.scss$/,
use: ExtractTextWebpackPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader', 'postcss-loader']
}),
exclude: /node_modules/
}
]
},
entry: {
main: [
path.resolve(__dirname, 'src', 'main.js'),
],
vendor: [
path.resolve(__dirname, 'vendor', 'main.js'),
],
polyfills: [
path.resolve(__dirname, 'polyfills', 'main.js'),
],
},
plugins: [
new ExtractTextWebpackPlugin({
filename: 'css/[name].css'
})
],
output: {
chunkFilename: 'js/[name].[chunkname].js',
filename: 'js/[name].js',
path: path.resolve(__dirname, '..', 'static', 'bundles')
},
mode: 'development',
optimization: {
splitChunks: {
cacheGroups: {
vendors: {
priority: -10,
test: /[\\/]node_modules[\\/]/
}
},
chunks: 'async',
minChunks: 1,
minSize: 30000,
name: true
}
}
};

View File

@ -1,35 +0,0 @@
{
"name": "uni2work",
"version": "1.0.0",
"description": "",
"keywords": [],
"author": "",
"license": "ISC",
"scripts": {
"babel": "babel static/es -d static/js",
"babel:watch": "watch 'npm run babel' static/es",
"lint": "eslint static/es"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"static/es/**/*.js": [
"eslint",
"git add"
]
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"watch": "^1.0.2"
}
}