From 87f092406dcd860e55a47c9920a5d3a52b366385 Mon Sep 17 00:00:00 2001 From: nsano-rururu Date: Thu, 21 Jul 2022 02:12:27 +0900 Subject: [PATCH 1/2] package update --- package.json | 35 +++++++++++++++++------------------ webpack/prod.js | 33 +++++++++++++-------------------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 6079099..10b2f25 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "prepublish": "npm run build" }, "main": "dist/vue-at.js", - "dependencies": {}, "engines": { "node": "14.x" }, @@ -19,40 +18,40 @@ "vue": "2.x" }, "devDependencies": { - "@babel/core": "^7.18.6", + "@babel/core": "^7.18.9", "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-decorators": "^7.18.6", + "@babel/plugin-proposal-decorators": "^7.18.9", "@babel/plugin-proposal-do-expressions": "^7.18.6", - "@babel/plugin-proposal-export-default-from": "^7.18.6", - "@babel/plugin-proposal-export-namespace-from": "^7.18.6", - "@babel/plugin-proposal-function-bind": "^7.18.6", + "@babel/plugin-proposal-export-default-from": "^7.18.9", + "@babel/plugin-proposal-export-namespace-from": "^7.18.9", + "@babel/plugin-proposal-function-bind": "^7.18.9", "@babel/plugin-proposal-function-sent": "^7.18.6", "@babel/plugin-proposal-json-strings": "^7.18.6", - "@babel/plugin-proposal-logical-assignment-operators": "^7.18.6", + "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.18.6", - "@babel/plugin-proposal-pipeline-operator": "^7.18.6", + "@babel/plugin-proposal-optional-chaining": "^7.18.9", + "@babel/plugin-proposal-pipeline-operator": "^7.18.9", "@babel/plugin-proposal-throw-expressions": "^7.18.6", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/preset-env": "^7.18.6", + "@babel/preset-env": "^7.18.9", "babel-loader": "^8.2.5", - "babel-preset-minify": "^0.5.1", + "babel-preset-minify": "^0.5.2", "cross-env": "^7.0.3", - "css-loader": "^0.28.11", + "css-loader": "^5.2.7", "element-ui": "^2.15.9", - "file-loader": "^1.1.9", - "node-sass": "^7.0.1", + "file-loader": "^6.2.0", + "sass": "^1.53.0", "sass-loader": "^10.3.1", - "style-loader": "^0.23.1", + "style-loader": "^2.0.0", + "terser-webpack-plugin": "^4.0.0", "textarea-caret": "^3.1.0", - "uglifyjs-webpack-plugin": "^1.3.0", "url-loader": "^4.1.1", - "vue": "^2.6.14", + "vue": "^2.7.7", "vue-loader": "^14.2.4", "vue-style-loader": "^4.1.3", - "vue-template-compiler": "^2.6.14", + "vue-template-compiler": "^2.7.7", "vuetify": "^2.6.7", "webpack": "^4.46.0", "webpack-cli": "^4.10.0", diff --git a/webpack/prod.js b/webpack/prod.js index d8d87a6..79a966b 100644 --- a/webpack/prod.js +++ b/webpack/prod.js @@ -1,4 +1,4 @@ -var UglifyJsPlugin = require('uglifyjs-webpack-plugin') +const TerserPlugin = require("terser-webpack-plugin"); var path = require('path') var webpack = require('webpack') var base = require('./base') @@ -28,24 +28,17 @@ Object.assign(config, { 'vue', 'textarea-caret' ]), - // todo: upgrade webpack to 3.x - // switched to uglifyjs-webpack-plugin - // https://github.com/vuejs-templates/webpack/blob/cd4d7d957c9af3d37092c79bf490b56b8d88b108/template/build/webpack.prod.conf.js#L37 - new UglifyJsPlugin({ - uglifyOptions: { - compress: { - warnings: false + ], + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + parallel: true, + terserOptions: { + compress: true, + sourceMap: true } - }, - sourceMap: true, - parallel: true - }) - // http://vue-loader.vuejs.org/en/workflow/production.html - // new webpack.optimize.UglifyJsPlugin({ - // sourceMap: true, - // compress: { - // warnings: false - // } - // }) - ] + }), + ] + } }) From a0596654893de7c101ec9e912d7522f6fe2172c3 Mon Sep 17 00:00:00 2001 From: nsano-rururu Date: Sat, 23 Jul 2022 05:29:14 +0900 Subject: [PATCH 2/2] webpack5 --- package.json | 14 +++++++------- webpack/base.js | 49 ++++++++++++++++++++++++++++++------------------- webpack/demo.js | 2 +- webpack/prod.js | 2 +- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 10b2f25..b031267 100644 --- a/package.json +++ b/package.json @@ -39,21 +39,21 @@ "babel-loader": "^8.2.5", "babel-preset-minify": "^0.5.2", "cross-env": "^7.0.3", - "css-loader": "^5.2.7", + "css-loader": "^0.28.11", "element-ui": "^2.15.9", "file-loader": "^6.2.0", "sass": "^1.53.0", - "sass-loader": "^10.3.1", - "style-loader": "^2.0.0", - "terser-webpack-plugin": "^4.0.0", + "sass-loader": "^13.0.2", + "style-loader": "^3.3.1", + "terser-webpack-plugin": "^5.3.3", "textarea-caret": "^3.1.0", "url-loader": "^4.1.1", - "vue": "^2.7.7", + "vue": "^2.7.8", "vue-loader": "^14.2.4", "vue-style-loader": "^4.1.3", - "vue-template-compiler": "^2.7.7", + "vue-template-compiler": "^2.7.8", "vuetify": "^2.6.7", - "webpack": "^4.46.0", + "webpack": "^5.73.0", "webpack-cli": "^4.10.0", "webpack-dev-server": "^3.11.0" } diff --git a/webpack/base.js b/webpack/base.js index 70ac4d9..d73fbe5 100644 --- a/webpack/base.js +++ b/webpack/base.js @@ -6,44 +6,55 @@ module.exports = { rules: [ { test: /\.vue$/, - loader: 'vue-loader', - options: { - loaders: { - // Since sass-loader (weirdly) has SCSS as its default parse mode, we map - // the "scss" and "sass" values for the lang attribute to the right configs here. - // other preprocessors should work out of the box, no loader config like this nessessary. - 'scss': 'vue-style-loader!css-loader!sass-loader', - 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax' - } - // other vue-loader options go here - } + use: ['vue-loader'] + }, + { + test: /\.scss$/, + use: [ + 'vue-style-loader', + 'css-loader', + 'sass-loader', + ] + }, + { + test: /\.sass$/, + use: [ + 'vue-style-loader', + 'css-loader', + 'sass-loader?indentedSyntax', + ] }, { test: /\.js$/, - loader: 'babel-loader', + use: ['babel-loader'], exclude: /node_modules/ }, { test: /\.css$/, - loader: 'style-loader!css-loader' + use: ['style-loader', 'css-loader'], }, { test: /\.(ttf|woff)$/, - loader: 'url-loader' + use: ['url-loader'], }, { test: /\.(png|jpg|gif|svg)$/, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]' - } + use: [ + { + loader: 'file-loader', + options: { + name: '[name].[ext]?[hash]' + } + } + ] } ] }, resolve: { alias: { + 'vue$': 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' webpack // https://vuejs.org/v2/guide/installation.html#Standalone-vs-Runtime-only-Build // 'vue$': 'vue/dist/vue.common.js' } } -} +} \ No newline at end of file diff --git a/webpack/demo.js b/webpack/demo.js index c8a1b10..c640678 100644 --- a/webpack/demo.js +++ b/webpack/demo.js @@ -17,7 +17,7 @@ Object.assign(config, { historyApiFallback: true, noInfo: true }, - devtool: isProd ? false : '#eval-source-map', + devtool: isProd ? false : 'eval-source-map', plugins: [ new webpack.DefinePlugin({ 'process.env': { diff --git a/webpack/prod.js b/webpack/prod.js index 79a966b..bb9364f 100644 --- a/webpack/prod.js +++ b/webpack/prod.js @@ -14,7 +14,7 @@ Object.assign(config, { filename: '[name].js', libraryTarget: 'commonjs2' }, - devtool: '#source-map', + devtool: 'source-map', plugins: [ new webpack.DefinePlugin({ 'process.env': {