1st commit

This commit is contained in:
Antti Pilto 2018-11-16 20:06:14 +02:00
parent 80fa494b1f
commit 79805945cc
4 changed files with 26 additions and 146 deletions

View file

@ -1,4 +1,3 @@
{ {
"presets" : ["es2015", "react"], "presets" : ["@babel/preset-env", "@babel/preset-react"],
"plugins" : ["transform-object-assign"] }
}

View file

@ -5,9 +5,9 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --host 0.0.0.0", "start": "webpack-dev-server --open --mode development --host 0.0.0.0",
"mobile": "webpack-dev-server --host 0.0.0.0 --public 192.168.1.8:8080", "mobile": "webpack-dev-server --open --mode development --host 0.0.0.0 --public 192.168.1.8:8080",
"build": "webpack -p --config webpack.config.prod.js" "build": "webpack --mode production"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,24 +20,24 @@
}, },
"homepage": "https://github.com/anzzstuff/kanaquiz#readme", "homepage": "https://github.com/anzzstuff/kanaquiz#readme",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"autoprefixer": "^6.3.7", "autoprefixer": "^6.3.7",
"babel-core": "^6.24.0", "babel-loader": "^8.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"css-loader": "^0.27.3", "css-loader": "^0.27.3",
"file-loader": "^0.10.1", "file-loader": "^0.10.1",
"html-webpack-plugin": "^2.22.0", "html-webpack-plugin": "^3.2.0",
"postcss": "^5.0.21", "postcss": "^5.0.21",
"postcss-loader": "^1.3.3", "postcss-loader": "^1.3.3",
"precss": "^1.4.0", "precss": "^1.4.0",
"react-hot-loader": "^1.3.0", "react-hot-loader": "^1.3.0",
"style-loader": "^0.14.1", "style-loader": "^0.14.1",
"sw-precache-webpack-plugin": "^0.10.1", "sw-precache-webpack-plugin": "^0.11.5",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"webpack": "^2.2.1", "webpack": "^4.24.0",
"webpack-dev-server": "^2.4.2" "webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
}, },
"dependencies": { "dependencies": {
"postcss": "^5.1.0", "postcss": "^5.1.0",

View file

@ -1,57 +1,13 @@
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = { module.exports = {
entry: [ module: {
'webpack-dev-server/client?http://localhost:8080', rules: [
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors {
'./src/index' test: /\.js$/,
], exclude: /node_modules/,
output: { use: {
path: path.resolve(__dirname, './dist'), loader: "babel-loader"
publicPath: '/', }
filename: 'bundle.js' }
}, ]
resolve: { }
extensions: ['.js', '.jsx'] };
},
plugins: [
new HtmlWebPackPlugin({
template: 'src/index.html',
filename: './index.html'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() {
return [autoprefixer, precss];
}
}
})
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot-loader', 'babel-loader']
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
}, {
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=25000'
}, {
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
}
};

View file

@ -1,75 +0,0 @@
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
module.exports = {
context: __dirname,
devtool: 'cheap-module-source-map',
entry: [
'./src/index'
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './dist/',
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
new HtmlWebPackPlugin({
template: 'src/index.html',
filename: '../index.html'
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress:{
warnings: false
},
}),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() {
return [autoprefixer, precss];
}
}
}),
new SWPrecacheWebpackPlugin( {
cacheId: 'kana-quiz',
filename: 'sw.js',
stripPrefix: '/home/anzz/Code/kanaquiz/',
maximumFileSizeToCacheInBytes: 4194304,
minify: true,
runtimeCaching: [{
handler: 'networkFirst',
urlPattern: /\.(woff2|svg|ttf|eot|woff|html)$/,
}],
})
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel-loader']
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
}, {
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=8192'
}, {
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
}
};