modernize Stuff

This commit is contained in:
marudor 2018-11-27 21:45:04 +01:00 committed by msquare
parent 36b7f8d2a2
commit c798aca98b
3 changed files with 35 additions and 20 deletions

View File

@ -1,5 +1,5 @@
{
"presets": [["env", {
"presets": [["@babel/preset-env", {
"targets": {
"chrome": 45,
"firefox": 42,
@ -8,8 +8,8 @@
"edge": 12,
"iOS": 9
},
"loose": true,
"useBuiltIns": true
"loose": false,
"useBuiltIns": "entry"
}]
],
"plugins": [

View File

@ -13,9 +13,9 @@
"build:watch": "webpack --watch"
},
"dependencies": {
"bootstrap": "^3.3.7",
"bootstrap": "^3",
"bootstrap-datepicker": "^1.7.1",
"chart.js": "^1.0.2",
"chart.js": "^1",
"jquery": "^3.3.1",
"jquery-ui": "^1.11.2",
"moment": "^2.8.2",
@ -23,19 +23,21 @@
"select2-bootstrap-theme": "0.1.0-beta.10"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"css-loader": "^0.28.7",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.6",
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"babel-loader": "^8.0.4",
"css-loader": "^1.0.1",
"file-loader": "^2.0.0",
"imports-loader": "^0.8.0",
"less": "^3.0.2",
"less-loader": "^4.0.5",
"mini-css-extract-plugin": "^0.4.5",
"mkdirp": "^0.5.1",
"npm-run-all": "^4.1.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"rimraf": "^2.6.2",
"style-loader": "^0.21.0",
"webpack": "^3"
"style-loader": "^0.23.1",
"webpack": "^4.26.1",
"webpack-cli": "^3.1.2"
}
}

View File

@ -1,6 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const nodeEnv = (process.env.NODE_ENV || 'development').trim();
// eslint-disable-next-line
@ -14,7 +15,10 @@ const plugins = [
NODE_ENV: JSON.stringify(nodeEnv),
},
}),
new ExtractTextPlugin('[name].css'),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id]-[hash].css',
}),
];
@ -24,6 +28,7 @@ for (let i = 0; i < 8; i++) {
}
module.exports = {
mode: __DEV__ ? 'development' : 'production',
context: __dirname,
resolve: {
extensions: ['.js', '.jsx'],
@ -37,6 +42,9 @@ module.exports = {
filename: '[name].js',
publicPath: '',
},
optimization: {
minimizer: __DEV__ ? [] : [new OptimizeCSSAssetsPlugin({})],
},
module: {
rules: [
{
@ -47,11 +55,16 @@ module.exports = {
},
{ test: /\.(eot|ttf|otf|svg|woff2?)(\?.*)?$/, loader: 'file-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.less$/, use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader!less-loader'
})}
{
test: /\.(less|css)$/,
use: [
{
loader: __DEV__ ? 'style-loader' : MiniCssExtractPlugin.loader,
},
{ loader: 'css-loader', options: { importLoaders: 1 } },
{ loader: 'less-loader' },
]
}
],
},
plugins,