modernize Stuff

main
marudor 6 years ago committed by msquare
parent 36b7f8d2a2
commit c798aca98b

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

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

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

Loading…
Cancel
Save